Difference between revisions of "LlOrd/ja"

From Second Life Wiki
Jump to navigation Jump to search
m
 
Line 1: Line 1:
{{LSL Function/ja
{{LSL Function/ja
|inject-2={{LSL_Function/negative index|true|index}}
|inject-2={{LSL_Function/negative index/ja|true|index}}
|func_sleep=0.0|func_energy=10.0
|func_sleep=0.0|func_energy=10.0
|func=llOrd|sort=Ord
|func=llOrd|sort=Ord
|func_desc=Calculate the ordinal value for a character in a string.
|func_desc=文字列内の文字の順序値を計算します。
|return_type=integer
|return_type=integer
|p1_type=string|p1_name=val|p1_desc=Source string for character ordinal.
|p1_type=string|p1_name=val|p1_desc=文字順序値のソース文字列。
|p1_hover=Source string for character ordinal.
|p2_type=integer|p2_name=index|p2_desc=取得する文字順序値のインデックス。
|p2_type=integer|p2_name=index|p2_desc=Index of character ordinal to retrieve.
|p2_hover=Index of character ordinal to retrieve.
|return_text=
|return_text=
|func_footnote=The returned value is the UTF-32 value of the character at the specified index.  If index is outside the bounds of the string, this function returns 0.
|func_footnote=返される値は、指定されたインデックスの文字のUTF-32値です。インデックスが文字列の範囲外の場合、この関数は0を返します。
|spec
|spec
|caveats
|caveats
Line 47: Line 45:
|helpers|related
|helpers|related
|also_functions=
|also_functions=
{{LSL DefineRow|[[llChar/ja]]|Convert an ordinal into a character}}
{{LSL DefineRow|[[llChar/ja]]|順序値を文字に変換}}
{{LSL DefineRow|[[llHash/ja]]|Calculate a 32bit hash for a string}}
{{LSL DefineRow|[[llHash/ja]]|文字列の32ビットハッシュを計算}}
|also_articles={{LSL DefineRow||{{wikipedia|UTF-32}}|}}
|also_articles={{LSL DefineRow||{{wikipedia|UTF-32}}|}}
|notes
|notes

Latest revision as of 15:01, 22 November 2023

要約

関数: integer llOrd( string val, integer index );

文字列内の文字の順序値を計算します。
integer で返します。

• string val 文字順序値のソース文字列。
• integer index 取得する文字順序値のインデックス。

index には 負のインデックス を使用できます。 返される値は、指定されたインデックスの文字のUTF-32値です。インデックスが文字列の範囲外の場合、この関数は0を返します。

仕様

インデックス
先頭 0 -length
末尾 length - 1 -1

インデックス

  • 正のインデックスは先頭から数えます。先頭の要素は 0、末尾の要素は (length - 1) のインデックスを持ちます。
  • 負のインデックスは末尾から数えます。先頭の要素は -length、末尾の要素は -1 のインデックスを持ちます。

警告

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

サンプル

default
{
    touch_start(integer total_number)
    {
        string test_string = "The quick brown fox jumped over the lazy dog";
        list test_list = [];
        string test_string2 = "";
        
        integer index;
        integer ord;
        for (index = 0; index < llStringLength(test_string); ++index)
        {
            ord = llOrd(test_string, index);
            test_list = test_list + [ ord ];
        }
        
        string char;
        for (index = 0; index < llGetListLength(test_list); ++index)
        {
            ord = llList2Integer(test_list, index);
            char = llChar(ord);
            test_string2 = test_string2 + char;
        }
        
        llSay(0, "\"" + test_string + "\" -> [" + 
            llDumpList2String(test_list, ", ") + "] -> \"" + test_string2 + "\"");
    }
}

関連項目

関数

• llChar/ja 順序値を文字に変換
• llHash/ja 文字列の32ビットハッシュを計算

記事

•  負のインデックス
•  "Wikipedia logo"UTF-32

特記事項

Search JIRA for related Issues

Signature

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