11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Caché</strong> <strong>ObjectScript</strong> FunctionsSET X="ENGINE",Y="Q"WRITE $FIND(X,Y)The following example returns 14, the position of the character immediately to the right ofthe first occurrence of “R” after the seventh character in X.SET X="EVERGREEN FOREST",Y="R"WRITE $FIND(X,Y,7)In the following example, $FIND begins its search after the last character in string. It returnszero (0):SET X="EVERGREEN FOREST",Y="R"WRITE $FIND(X,Y,20)The following example uses name indirection to return 6, the position of the characterimmediately to the right of the substring “THIS”:SET Y="x",x="""THIS IS A TEST"""WRITE $FIND(@Y,"THIS")For more information, refer to Indirection in Using <strong>Caché</strong> <strong>ObjectScript</strong>.Notes$FIND, $EXTRACT, $PIECE, and $LIST• $FIND locates a substring by value and returns a position.• $EXTRACT locates a substring by position and returns the substring value.• $PIECE locates a substring by a delimiter character or delimiter string, and returns thesubstring value.• $LIST operates on specially encoded strings. It locates a substring by substring countand returns the substring value.The $FIND, $EXTRACT, $LENGTH, and $PIECE functions operate on standard characterstrings. The various $LIST functions operate on encoded character strings, which areincompatible with standard character strings. The sole exception is the one-argument andtwo-argument forms of $LIST, which take an encoded character string as input, but outputa single element value as a standard character string.See Also• $EXTRACT function• $LENGTH function212 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!