LlInsertString/ja

From Second Life Wiki
Jump to navigation Jump to search

要約

関数: 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

サンプル

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

便利なスニペット

この関数では、位置に負の数を使用することができます。 <lsl>string insertString(string destination, integer position, string str) {

   if (position < 0)
       if ((position += llStringLength(destination)) < 0)
           position = 0;
   return llInsertString(destination, position, str);

}</lsl>

関連項目

関数

•  llDeleteSubString
•  llGetSubString

記事

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

特記事項

Search JIRA for related Issues

Signature

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