Difference between revisions of "LlReplaceSubString/ja"

From Second Life Wiki
Jump to navigation Jump to search
m
m
 
Line 8: Line 8:
|p3_type=string|p3_name=replacement_pattern
|p3_type=string|p3_name=replacement_pattern
|p4_type=integer|p4_name=count
|p4_type=integer|p4_name=count
|func_footnote=If '''count''' = 0, all matching substrings are replaced.  If '''count''' > 0, substrings are replaced starting from the left/beginning of '''src'''.  If '''count''' < 0, substrings are replaced starting from the right/end of '''src'''.
|func_footnote=もし '''count''' = 0 なら、全ての一致する部分文字列が置換されます。もし '''count''' > 0 なら、'''src'''の左端/始まりから一致する部分文字列が置換されます。もし '''count''' < 0 なら、'''src'''の右端/終わりから一致する部分文字列が置換されます。
|func_desc
|func_desc
|return_text=that is the result of replacing the first '''count''' matching instances '''pattern''' in '''src''' with '''replacement_pattern'''.
|return_text=は、'''src'''内の最初の'''count'''個の一致する'''pattern''''''replacement_pattern'''で置換した結果です。
|spec
|spec
|caveats
|caveats

Latest revision as of 15:02, 22 November 2023

要約

関数: string llReplaceSubString( string src, string pattern, string replacement_pattern, integer count );

は、src内の最初のcount個の一致するpatternreplacement_patternで置換した結果です。を string で返します。

• string src
• string pattern
• string replacement_pattern
• integer count

もし count = 0 なら、全ての一致する部分文字列が置換されます。もし count > 0 なら、srcの左端/始まりから一致する部分文字列が置換されます。もし count < 0 なら、srcの右端/終わりから一致する部分文字列が置換されます。

サンプル

default
{
    state_entry()
    {
        string ex = "red foxes, red hens, red turnips";
        // Replace first 2 matches, starting from the left side
        ex = llReplaceSubString(ex, "red", "blue", 2);
        llSay(0, ex); // Should say "blue foxes, blue hens, red turnips"
    }
}
default
{
    state_entry()
    {
        string ex = "red foxes, red hens, red turnips";
        // Replace first match, starting from the right side
        ex = llReplaceSubString(ex, "red", "green", -1);
        llSay(0, ex); // Should say "red foxes, red hens, green turnips"
    }
}
default
{
    state_entry()
    {
        string ex = "red foxes, red hens, red turnips";
        // Replace all matches
        ex = llReplaceSubString(ex, "red", "yellow", 0);
        llSay(0, ex); // Should say "yellow foxes, yellow hens, yellow turnips"
    }
}

関連項目

特記事項

Search JIRA for related Issues

Signature

function string llReplaceSubString( string src, string pattern, string replacement_pattern, integer count );
この翻訳は 原文 と比べて古いですか?間違いがありますか?読みにくいですか?みんなで 修正 していきましょう! (手順はこちら)
この項目はあなたにとって参考にならない項目ですか?もしかしたらLSL Wikiの関連した項目が参考になるかもしれません。