Difference between revisions of "LlInsertString/ja"

From Second Life Wiki
Jump to navigation Jump to search
m (Undo revision 851892 by Mako Nozaki (Talk))
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{LSL_Function/negative_index/ja|false|position}}{{LSL_Function/ja|func_id=96|func_sleep=0.0|func_energy=10.0
{{LSL_Function/negative_index/ja|false|pos}}{{LSL_Function/ja
|func_id=96|func_sleep=0.0|func_energy=10.0
|func=llInsertString|return_type=string
|func=llInsertString|return_type=string
|p1_type=string|p1_name=dst|p1_desc=挿入する先
|p1_type=string|p1_name=dst|p1_desc=挿入先
|p2_type=integer|p2_name=pos|p2_desc=挿入する位置の指標で、最初は0です
|p2_type=integer|p2_name=pos|p2_desc=挿入先インデックス位置、先頭は 0
|p3_type=string|p3_name=src|p3_desc=元のstringに挿入されます
|p3_type=string|p3_name=src|p3_desc=挿入する文字列
|func_footnote
|func_footnote={{LSLG/ja|llGetSubString}} や {{LSLG/ja|llDeleteSubString}} のような、他の同じような文字列関数とは異なり、この関数のカウンタに -1 を使用することはできません。その代わりに若干下のほうに掲載されている関数を使うことになるでしょう。
|func_desc
|func_desc
|return_text='''src''''''pos'''の位置から挿入された'''dst'''
|return_text='''pos''' を先頭に '''src''' が挿入された '''dst''' 
|spec
|spec
|caveats
|caveats
|constants
|constants
|examples=
|examples=
<lsl>llInsertString("input", 2, "put out")// returns "input output"</lsl>
<source lang="lsl2">llInsertString("input", 2, "put out")// "input output" と返ってきます</source>
|helpers
|helpers=この関数では、位置に負の数を使用することができます。
|also_functions={{LSL DefineRow||[[llDeleteSubString/ja|llDeleteSubString]]}}
<source lang="lsl2">string insertString(string destination, integer position, string str) {
{{LSL DefineRow||[[llGetSubString/ja|llGetSubString]]}}
    if (position < 0)
        if ((position += llStringLength(destination)) < 0)
            position = 0;
    return llInsertString(destination, position, str);
}</source>
|also_functions={{LSL DefineRow||{{LSLG/ja|llDeleteSubString}}}}
{{LSL DefineRow||{{LSLG/ja|llGetSubString}}}}
|also_events
|also_events
|also_tests
|also_tests
|also_articles={{LSL DefineRow||[[:Category:LSL Examples|Examples:]] [[Library_Combined_Library#str_replace|str_replace]]|他のstring内に対象のstringがある場合、置換します}}
|also_articles={{LSL DefineRow||[[:Category:LSL Examples|サンプル:]] [[Library_Combined_Library#str_replace|str_replace]]|他の文字列の中に入っている文字列を全て指定した文字列に置き換えます}}
{{LSL DefineRow||[[:Category:LSL Examples|Examples:]] [[SplitLine]]|stringの幾つかの位置に'改行'エスケープコードを挿入します}}
{{LSL DefineRow||[[:Category:LSL Examples|サンプル:]] [[SplitLine]]|文字列の適当な位置に改行エスケープコードを入れます}}
|notes
|notes
|helpers
|helpers

Latest revision as of 14:35, 25 February 2016

要約

関数: string llInsertString( string dst, integer pos, string src );

pos を先頭に src が挿入された dst を string で返します。

• string dst 挿入先
• integer pos 挿入先インデックス位置、先頭は 0
• string src 挿入する文字列

pos には 負のインデックス を使用できません。 llGetSubStringllDeleteSubString のような、他の同じような文字列関数とは異なり、この関数のカウンタに -1 を使用することはできません。その代わりに若干下のほうに掲載されている関数を使うことになるでしょう。

警告

  • pos が正常なインデックス範囲を外れていても、スクリプトはエラー表示を出さずに処理を続けます。
All Issues ~ Search JIRA for related Bugs

サンプル

llInsertString("input", 2, "put out")// "input output" と返ってきます

便利なスニペット

この関数では、位置に負の数を使用することができます。

string insertString(string destination, integer position, string str) {
    if (position < 0)
        if ((position += llStringLength(destination)) < 0)
            position = 0;
    return llInsertString(destination, position, str);
}

関連項目

関数

•  llDeleteSubString
•  llGetSubString

記事

•  サンプル: str_replace 他の文字列の中に入っている文字列を全て指定した文字列に置き換えます
•  サンプル: SplitLine 文字列の適当な位置に改行エスケープコードを入れます

特記事項

Search JIRA for related Issues

Signature

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