6.1.9:Specifying
a Chunk
チャンクを指定する
The
simplest chunk expression specifies a single chunk of any
type. The following statements all include valid chunk
expressions:
最も単純なチャンク表現式は、どの形式でも単一のチャンクを指定するものです。次のステイトメント例は全て正しいチャンク表現式を使っています。
get char
2 of "ABC" -- yields "B"
文字列「ABC」の2番目のキャラクタでキャラクタ「B」が得られます
get word
4 of "This is a test" -- yields "test"
ワード(単語)四つで成り立っている文「This
is a
test」の四番目のワード(単語)で「test」が得られます
get line 7 of myTestData
myTestDataの七番目の行(ライン)
put "A" into char 2 of myVariable
キャラクタ「A」を変数「myVariable」の二番目のキャラクタに入れる
You can also use the ordinal numbers first,
last,
middle,
second,
third,
fourth,
fifth,
sixth,
seventh,
eighth,
ninth,
and tenth
to designate single
chunks. The special ordinal any
specifies a random
chunk.
単一のチャンクを指定するのに、first、last、middle、second、third、fourth、fifth、sixth、seventh、eighth、ninth、tenth、の序数を使うこともできます。
put "7"
into last char of "1085" -- yields "1087"
「7」を「1085」の最後のキャラクタに入れると結果は「1087」になる