# col2() function

The col2() function returns the numeric
column position of the character following the substring retrieved
in the most recently executed field() function.

## Syntax

```
col2()
```

## Description

The parentheses following the
function are required, and contain no arguments.

col2() allows nonsystem delimited strings to be handled like dynamic arrays.

If the (search) value does not exist in the string being searched
by the field() function, and the field requested
is 1, then col2() returns the length of the string.
If the same situation occurs, but the field requested is 2 or higher,
then the col2() returns 0.

## Example(s)

This example removes green from the colors.

```
colors = "blue*green*red*yellow"
name = field(colors,"*",2)
startpos = col1() ;* start.pos is 5
endpos = col2() ;* end.pos is 11
colors = colors[1,startpos]:colors[endpos+1,100]
```

## See also

- [field() function](https://d3codex.com/pickbasic-flashbasic/field-function/)
- [BASIC functions](https://d3codex.com/pickbasic-flashbasic/basic-functions/)
- [Statements and functions](https://d3codex.com/pickbasic-flashbasic/statements-and-functions/)

---
Source: https://d3codex.com/pickbasic-flashbasic/col2-function/ - part of the D3Codex reference.
