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?

リスト

これまで ObjectScript のすべてのデータが、文字列であることを学習しました。リストとは、項目のリストを形成する特殊な文字列です。既に説明した文字列関数に類似する以下のリスト関数を使用して、リストを操作できます。

  • $ListBuild は項目から生成されたリストを返します。

  • $List はリストで指定された要素を返します。

  • $ListLength は、リストの要素数を返します。

  • $ListFind は、リスト内の項目を検索し、その項目の番号を返します。

SAMPLES>set addr = "One Memorial Drive", city = "Cambridge"

SAMPLES>set st = "MA", zip = "02142"

SAMPLES>set mail = $listbuild(addr, city, st, zip)

SAMPLES>write $list(mail, 2)
Cambridge
SAMPLES>write $listlength(mail)
4
SAMPLES>write $listfind(mail, "MA")
3
SAMPLES>

リスト以外の文字列にはリスト関数は使用できません。使用した場合、<LIST> エラーが生成されます。同様に、リストでは文字列関数を使用しません。リスト関数の略語は 2 文字か 3 文字です。

FeedbackOpens in a new tab