文字列に対する抽象クラス。
説明
注意事項
| self が空であるかどうかを検査します。 |
| 文字列に対して繰り返し処理を実行するコンテナである |
| self 内の文字数。 |
| self を、指定された |
| self と、指定された |
| self を検索し、特定の文字 c があるかどうかを調べます。 |
| self を検索し、char-class 内の文字があるかどうかを調べます。 |
| self を検索し、部分文字列 str があるかどうかを調べます。 |
| self 内の指定された文字を返します。 |
| self の先頭が str である場合、true を返します。 |
| old の各オカレンスが new に置換される場合に新しい |
| self を、指定された文字の出現個所で分割します。 |
| self の指定された部分文字列を返します。 |
| self の末尾が str である場合、true を返します。 |
| {self.substr , self.size - } を返します。 |
| self を解析して |
| self を格納する入力ストリームを返します。 |
| self を解析して |
| self を解析して |
| self のクローンを返します。文字は小文字に変換されます。 |
| self と同一 (==) の |
| self のクローンを返します。文字は大文字に変換されます。 |
| self のクローンを返します。その際、文字列の左端と右端の両方がトリミングされます。 |
| self のクローンを返します。その際、文字列の左端だけがトリミングされます。 |
| self のクローンを返します。その際、文字列の右端だけがトリミングされます。 |
self が空であるかどうかを検査します。
戻り値
例
| 例 | |
{value
|| Declare and initialize an empty string
let s:String = ""
|| Check if the string is empty and display an
|| appropriate message
{if s.empty? then
{text The string is empty!}
else
{text The string has characters!}
}
}
|
| 例 | |
{value
|| Declare and initialize a string
let s:String = "Hello World!"
|| Check if the string is empty and display an
|| appropriate message
{if s.empty? then
{text The string is empty!}
else
{text The string has characters!}
}
}
|
文字列に対して繰り返し処理を実行するコンテナである
注意事項
self 内の文字数。
戻り値
説明
例
| 例 | |
{value
|| Declare and initialize a read-only string
let s:String = "Hello World!"
|| Output a message that includes the return value of
|| a call to "size".
|| Note that you must use "value" to display the value
|| of "s.size", rather than the text "s.size".
{text There are {value s.size} characters in the string.}
}
|
| 例 | |
{value
|| Declare and initialize a writable string.
let sb:StringBuf = {StringBuf "Hello World!"}
|| Set the size of the string to 5 characters.
|| The string should now contain only the first five
|| characters, "Hello".
set sb.size = 5
|| Output a message that includes the new string
{text If {monospace size} is set to 5, the string
becomes: {value sb}}
}
|
| 例 | |
{value
|| Declare and initialize a writable string.
let sb:StringBuf = {StringBuf "Hello World!"}
|| Set the size of the string to 20 characters.
|| The string should now have 8 characters
|| with the Unicode value 0000 at the end.
set sb.size = 20
|| Output a message that includes the new string.
{text Then, if {monospace size} is set to 20, the string
becomes: {value sb}}
}
|
注意事項
self を、指定された
戻り値
説明
例
| 例 | |
![]() | |
{value
|| Declare and initialize two strings
let s1:String = "Hello World!"
let s2:String = "hello world!"
|| Display the strings.
{text String 1: {value s1}
{br}String 2: {value s2}
|| Compare the two strings and display an
|| appropriate message.
{switch {s1.compare s2}
case -1 do
{text String 1 is less than String 2.}
case 0 do
{text String 1 is equal to String 2.}
else
{text String 1 is greater than String 2.}
}
|| Compare the two strings, this time ignoring case,
|| and display an appropriate message.
But, if you ignore case,
{switch {s1.compare s2, ignore-case? = true}
case -1 do
{text String 1 is less than String 2.}
case 0 do
{text String 1 is equal to String 2.}
else
{text String 1 is greater than String 2.}
}
}
}
|
self と、指定された
戻り値
例
| 例 | |
![]() | |
{value
|| Declare and initialize two strings
let s1:String = "Hello World!"
let s2:String = "hello world!"
|| Display the strings.
{text
String 1: {value s1}
{br}String 2: {value s2}
|| Test if the two strings are equal and display
|| an appropriate message.
{if {s1.equal? s2} then
{text The strings are equal.}
else
{text The strings are NOT equal.}
}
|| Test if the two strings are equal, this time
|| ignoring case, and display an appropriate message.
But, if you ignore case,
{if {s1.equal? s2, ignore-case? = true} then
{text they are equal.}
else
{text they are NOT equal.}
}
}
}
|
self を検索し、特定の文字 c があるかどうかを調べます。
戻り値
説明
self を検索し、char-class 内の文字があるかどうかを調べます。
戻り値
説明
self を検索し、部分文字列 str があるかどうかを調べます。
戻り値
説明
self 内の指定された文字を返します。
例外のスロー
index が範囲外の場合は例
| 例 | |
{value
|| Declare and initialize a string.
let s:String = "Hello World!"
|| Display the string and return the
|| character at position 7.
|| Remember that the leftmost position
|| is 0 (zero).
{text {value s}
{br}The character at position 7 is {s.get 7}.}
}
|
注意事項
self の先頭が str である場合、true を返します。
old の各オカレンスが new に置換される場合に新しい
説明
例
| 例 | |
{value
|| Declare and initialize a String.
let x:String = "Silly willy"
|| Replace each occurrence of "ill" with "ick".
let y:String = {x.replace-clone "ill", "ick"}
|| Display the resulting String.
y
}
|
self を、指定された文字の出現個所で分割します。
戻り値
説明
例
| 例 | |
![]() | |
{value
|| Declare and initialize a string.
let s:String = "www.curl.com"
|| Split the string at the periods.
let a:StringArray = {s.split split-chars = "."}
|| Declare and instantiate a VBox for displaying
|| an output message indicating the results.
let out:VBox = {VBox}
|| For each element in the results array, add it
|| to the output message.
{for str in a do
{out.add str}
}
|| Display the string and the output message.
{text String: {value s}
{br}Splitting the string returns the following strings...
{br}{value out}
}
}
|
self の指定された部分文字列を返します。
戻り値
注意事項
例
| 例 | |
{value
|| Declare and initialize s1 (the original string).
let s1:String = "Hello World!"
|| Initialize s2 with a substring of s1. The
|| substring begins at position 6 and is 5
|| characters long ("World").
|| Remember that the leftmost position
|| is 0 (zero).
let s2:String = {s1.substr 6, 5}
|| Display the contents of s2.
{value s2}
}
|
注意事項
self の末尾が str である場合、true を返します。
{self.substr , self.size - } を返します。
self を解析して
戻り値
説明
例
| 例 | |
{value
|| Declare and initialize a string
let s:String = " 365e-10"
|| Declare variables to hold the return values from
|| a call to "to-double"
let number:double
let chars:int
let over-or-underflow?:bool
|| Call "to-double" and assign the multiple return
|| values to the variables.
set (number, chars, over-or-underflow?) =
{s.to-double error-if-over-or-underflow? = false}
|| Display a message containing the result of a call
|| to "to-double".
|| Note that you must use "value" to display the values
|| of the variables.
{text The number is {value number}, which occupied
{value chars} characters in the original string.}
|| Note that you can use "format" to change how Curl
|| displays numbers.
}
|
| 例 | |
{value
|| Declare and initialize a string
let s:String = "365e-10 is the multiplier"
|| Declare variables to hold the return values from
|| a call to "to-double"
let number:double
let chars:int
let over-or-underflow?:bool
|| Call "to-double" and assign the multiple return
|| values to the variables.
set (number, chars, over-or-underflow?) =
{s.to-double error-if-over-or-underflow? = false}
|| Display a message containing the result of a call
|| to "to-double".
{text The number is {value number}. {value chars}
characters were parsed.}
}
|
| 例 | |
{value
|| Declare and initialize a string
let s:String = "365e-10 is the multiplier"
|| Declare variable to hold the return value from
|| a call to "to-double"
let number:double
|| Call "to-double" and assign the first return
|| value to the variable.
set number = {s.to-double}
|| Display a message containing the result of a call
|| to "to-double".
{text The number is {value number}.}
}
|
self を格納する入力ストリームを返します。
戻り値
説明
例
| 例 | |
{value
|| Declare and initialize a string.
let s:String = "Hello World!"
|| Use to-InputStream to set the contents of "s"
|| to the input stream.
let tis:TextInputStream = {s.to-InputStream}
|| Retrieve (and display) a string from the input
|| stream.
{tis.read-one-string}
}
|
注意事項
self を解析して
戻り値
説明
例
| 例 | |
{value
|| Declare and initialize a string
let s:String = " -0X16D"
|| Declare variables to hold the return values from
|| a call to "to-int"
let number:int
let chars:int
let overflow?:bool
|| Call "to-int" and assign the multiple return
|| values to the variables.
set (number, chars, overflow?) =
{s.to-int error-if-overflow? = false}
|| Display a message containing the result of a call
|| to "to-int".
|| Note that you must use "value" to display the values
|| of the variables.
{text The number is {value number}. {value chars}
characters were parsed.}
|| Note that to display an integer in a number system
|| other than decimal, you must use "format".
}
|
| 例 | |
{value
|| Declare and initialize a string
let s:String = "365 days of the year"
|| Declare variables to hold the return values from
|| a call to "to-int"
let number:int
let chars:int
let overflow?:bool
|| Call "to-int" and assign the multiple return
|| values to the variables.
set (number, chars, overflow?) =
{s.to-int error-if-overflow? = false}
|| Display a message containing the result of a call
|| to "to-int".
{text The number is {value number}. {value chars}
characters were parsed.}
}
|
| 例 | |
{value
|| Declare and initialize a string
let s:String = "365 days of the year"
|| Declare a variable to hold the first return value
|| from a call to "to-int"
let number:int
|| Call "to-int" and assign the first return
|| value to the variable.
set number = {s.to-int}
|| Display a message containing the result of a call
|| to "to-int".
{text The number is {value number}.}
}
|
self のクローンを返します。文字は小文字に変換されます。
戻り値
例
| 例 | |
{value
|| Declare and initialize a string
let s1:String = "Hello World!"
|| Initialize s2 with a string containing the
|| characters of s1 in lowercase.
let s2:String = {s1.to-lower-clone}
|| Display the contents of s2.
{value s2}
}
|
注意事項
self と同一 (==) の
戻り値
例
| 例 | |
{value
|| Define and initialize a StringBuf.
let sb:StringBuf = {StringBuf "Hello World!"}
|| Convert the StringBuf to a String.
let s:String = {sb.to-String}
|| Display the contents of the String.
{value s}
}
|
self のクローンを返します。文字は大文字に変換されます。
戻り値
例
| 例 | |
{value
|| Declare and initialize a string
let s1:String = "Hello World!"
|| Initialize s2 with a string containing the
|| characters of s1 in uppercase.
let s2:String = {s1.to-upper-clone}
|| Display the contents of s2.
{value s2}
}
|
注意事項
self のクローンを返します。その際、文字列の左端と右端の両方がトリミングされます。