Returning a substring from a string¶
getstr() |
Return a substring from a string |
SYNTAX
getstr(source, position, length)
Return a substring from a longer string.
source |
The source string. |
position |
The starting position of the substring to be extracted. The first character in source is position 1. If position is less than 1, or greater than the length of source, then a null string is returned. |
length |
The length of the substring to be extracted. If the specified length is greater than the number of characters remaining in the field after position, then only those characters remaining are returned. |
EXAMPLE
If Field is longer than Length, this function trims it and adds “…” to indicate the truncation:
!Function StringFormat(Field, Length) {
!temp Output,,a255
if (strlen(Field) > Length) then Output = getstr(Field, 1, Length -3) / "..." \
else Output = Field
return Output
}
RELATED TOPICS |