The SUBSTRDW() function extracts a substring based on its display width. The SUBSTRDWS() function is similar but operates on successive elements of a dynamic array, returning a similarly structured dynamic array of results.
SUBSTRDW(string, start, length)
SUBSTRDWS(string, start, length)
On an ECS mode system, some characters may require two columns for display or printing. The SUBSTRDW() function extracts a substring that will require len columns for display. If the substring extends beyond the end of string, the returned data will be shorter than the limit specified by the length argument.
On a non-ECS system, this function is equivalent to use of the standard substring operator string[start, length].
I = 1
S = SUBSTRDW(TEXT, I, 30)
UNTIL S = ""
I += LEN(S)
This program fragment displays the data in TEXT as a series of lines that fit a display width of 30 columns. Note how the start position index, I, is incremented by the number of characters in each substring instead of the display width.