Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

区切り文字列

Piece() には他にも特徴があります。単一の文字ではなく、各種部分文字列を返します。異なる区切り文字を使用して、同じ文字列から部分文字列を返すこともできます。Piece() は返り値が空の場合、空文字列を返します (最初の区切り文字の前に値がない、あるいは区切り文字が 2 つ連続していない場合)。

println "using string: slice of pizza"
println "3rd piece = ", piece("slice of pizza", " ", 3)
println "1st and 2nd pieces = ", piece("slice of pizza", " ", 1, 2)
println "2nd piece by i = ", piece("slice of pizza", "i", 2)
println "2nd (empty) piece by z = ", piece("slice of pizza", "z", 2)
println "count of pieces = ", len("slice of pizza", " ")
address = "One Memorial Drive^Cambridge^MA^02142"
city = piece(address, "^", 2)
println "city = ", city
println "MA starts at position #", InStr(address, "^MA^")+1 ' one past ^
FeedbackOpens in a new tab