Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Previous sectionNext section


Returns the FIELD substring start position.




The COL1 function takes no arguments. The parentheses are mandatory.


The COL1 function returns the starting position for the most recently called FIELD function. FIELD extracts a substring from a string by specifying a delimiter character. The specified delimiter immediately precedes the extracted substring. COL1 returns the string position (counting from 1) of this delimiter character.

If the FIELD count is 1, COL1 returns 0. If the FIELD count is greater than the number of delimited substrings, COL1 returns 0. If the FIELD delimiter is not located in string, COL1 returns 0

The initial COL1 value is 0. The COL1 value is preserved until it is overwritten by the next FIELD function call.

COL1 returns a substring's start delimiter position. COL2 returns a substring's end delimiter position.


The following example shows the use of the COL1 function:

FOR x=1 TO 5
   PRINT FIELD(colors,"^",x)
   PRINT "Start delimiter position: ":COL1()
      ! Returns: 0, 4, 10, 15, 22
Copy code to clipboard

See Also