This procedure converts string value (character field) to array of words.
To avoid memory leak remember to destroy array after ussage! See arrayDestroy procedure() `
Parameter | Type | Description | |
---|---|---|---|
stringPtr | POINTER | Mandatory | Pointer to variable which contains character value (sentence) |
stringLen | 9P 0 | Mandatory | Length of text in bytes |
delimiter | 30A | Optional | list 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']