stringライブラリ
ライブラリ日本語解説あり
ひとことで言うと
文字列を扱うためのライブラリです。文字数を数える・一部を取り出す・大文字にする・検索する、などができます。
公式の説明(英語):Provides generic functions to manipulate strings.
関数(17)
| 名前と書き方 | 説明 |
|---|---|
bytestring.byte(s: string, i: number, j: number): int | Returns the internal numerical codes of the characters s[i], s[i+1], ..., s[j]. The default value for i is 1; the default value for j is i. These indices are corrected following the same rules of function string.sub. |
charstring.char(...: int): string | Receives zero or more integers and returns a string with length equal to the number of arguments, in which each character has the internal numerical code equal to its corresponding argument. |
findstring.find(s: string, pattern: string, init: number, plain: bool): number, number | 文字列の中から探して、位置を返します。Looks for the first match of pattern in the string s and returns the indices of s where the occurrence starts and ends. |
formatstring.format(formatstring: string, ...: string): string | 書式を指定して文字列を作ります。Returns a formatted version of its variable number of arguments following the description given in its first argument, which must be a string. |
gmatchstring.gmatch(s: string, pattern: string): function | Returns an iterator function that returns the next captures from pattern over the string s each time it's called. |
gsubstring.gsub(s: string, pattern: string, replacement: Variant, replacements: number): string, number | Returns a copy of s in which all or the first n occurrences of the pattern are replaced with the given replacement. The second value returned is the total number of substitutions made. |
lenstring.len(s: string): int | 文字列の長さ(バイト数)を返します。Returns the length of a string. |
lowerstring.lower(s: string): string | 小文字にします。Returns a copy of a string with all uppercase letters changed to lowercase. |
matchstring.match(s: string, pattern: string, init: number): string | Looks for the first match of pattern in the string s. |
packstring.pack(format: string, ...: Variant): string | Returns a binary string containing the provided arguments. |
packsizestring.packsize(format: string): number | Returns the size in bytes of any string packed with a given description. |
repstring.rep(s: string, n: int): string | 文字列をくりかえします。Returns a string that is the concatenation of n copies of the string s. |
reversestring.reverse(s: string): string | Returns a string that is the string s reversed. |
splitstring.split(s: string, separator: string): table | 区切り文字で分けて配列にします。Splits a string into parts based on the defined separator character(s), returning a table of ordered results. |
substring.sub(s: string, i: int, j: int): string | 文字列の一部を取り出します。Returns the substring of s that starts at i and continues until and including j. i and j can be negative. i defaults to 1 and j defaults to -1. |
unpackstring.unpack(format: string, data: string, readStart: string): Tuple | Extracts the values packed in the provided binary string. |
upperstring.upper(s: string): string | 大文字にします。Returns a copy of a string with all lowercase letters changed to uppercase. |
stringを使う記事
英語の説明とメンバーの一覧は、Roblox Creator Documentation(string)をもとにしています(CC BY 4.0)。日本語の解説は、このサイトで独自に書いたものです。