stringToArray()

This procedure converts string value (character field) to array of words.

To avoid memory leak remember to destroy array after ussage! See arrayDestroy procedure() `

ParameterTypeDescription
stringPtrPOINTERMandatoryPointer to variable which contains character value (sentence)
stringLen9P 0MandatoryLength of text in bytes
delimiter30AOptionallist of characters which should be used as delimiter to divide sentence into words. Note: The SPACE is always used

Procedure returns pointer to array where separated words are stored.

Examples:

xxText = 'Example of text';
xxPtr = stringToArray(%ADDR(xxText): %LEN(%TRIMR(xxText)));
//This will create array with following elements: ['Example','of','text']

xxText = 'Example numbers: 1,2,3,4';
xxPtr = stringToArray(%ADDR(xxText): %LEN(%TRIMR(xxText)): ',');
//This will create array with following elements: ['Example','numbers:','1','2','3','4']