VSLICE()

VSLICE()

Top  Previous  Next

 

The VSLICE() function returns a string formed by extracting a given value or subvalue position from a dynamic array.

 

 

Format

 

VSLICE(string, vpos)

VSLICE(string, vpos, svpos)

 

where

 

stringis the string from which the data is to be extracted.

 

vposevaluates to the value position to be extracted.

 

svposevaluates to the subvalue position to be extracted.

 

 

The first form of the VSLICE() function processes string to build a new dynamic array containing only the specified value position from each field. Subvalues are returned as part of each value in the result string.

 

The second form processes string to build a new dynamic array containing only the specified subvalue position from each field. If vpos is less than one, the subvalue is extracted from all value positions and value marks are included in the returned string to match the structure of the original data. If vpos is one or greater, the subvalue is extracted only from the specified value position and no value marks are included in the result.

 

If vpos and svpos are both less than one, the VSLICE() function returns the source string.

 

 

Examples

 

The following examples are all based on a string that contains

     1FM2VM3SM4VM5FM6VM7SM8VM9

 

VSLICE(S, 0)1FM2VM3SM4VM5FM6VM7SM8VM9
VSLICE(S, 1)1FM2FM6
VSLICE(S, 2)FM3SM4FM7SM8
VSLICE(S, 3)FM5FM9

 

VSLICE(S, 0, 1)1FM2VM3VM5FM6VM7VM9
VSLICE(S, 0, 2)FMVM4FMVM8

VSLICE(S, 0, 3)

 

VSLICE(S, 1, 1)1FM2FM6

VSLICE(S, 1, 2)

 

VSLICE(S, 2, 1)FM3FM7
VSLICE(S, 2, 2)FM4FM8

VSLICE(S, 2, 3)

 

VSLICE(S, 3, 1)FM5FM9

VSLICE(S, 3, 2)