Difference between revisions of "LlOrd/ja"

From Second Life Wiki
Jump to navigation Jump to search
(copy from english(Todo: need translate to japanese))
 
m
Line 1: Line 1:
{{LSL Function
{{LSL Function/ja
|inject-2={{LSL_Function/negative index|true|index}}
|inject-2={{LSL_Function/negative index|true|index}}
|func_sleep=0.0|func_energy=10.0
|func_sleep=0.0|func_energy=10.0
Line 47: Line 47:
|helpers|related
|helpers|related
|also_functions=
|also_functions=
{{LSL DefineRow|[[llChar]]|Convert an ordinal into a character}}
{{LSL DefineRow|[[llChar/ja]]|Convert an ordinal into a character}}
{{LSL DefineRow|[[llHash]]|Calculate a 32bit hash for a string}}
{{LSL DefineRow|[[llHash/ja]]|Calculate a 32bit hash for a string}}
|also_articles={{LSL DefineRow||{{wikipedia|UTF-32}}|}}
|also_articles={{LSL DefineRow||{{wikipedia|UTF-32}}|}}
|notes
|notes

Revision as of 12:14, 2 November 2023

要約

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

Calculate the ordinal value for a character in a string.
integer で返します。

• string val Source string for character ordinal.
• integer index Index of character ordinal to retrieve.

index supports negative indexes. 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.

仕様

Index Positive Negative
First 0 -length
Last length - 1 -1

Indexes

  • Positive indexes count from the beginning, the first item being indexed as 0, the last as (length - 1).
  • Negative indexes count from the far end, the first item being indexed as -length, the last as -1.

警告

  • If index is out of bounds the script continues to execute without an error message.

サンプル

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 Convert an ordinal into a character
• llHash/ja Calculate a 32bit hash for a string

記事

•  Negative Index
•  "Wikipedia logo"UTF-32

特記事項

Search JIRA for related Issues

Signature

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