The  (square brackets) function helps extract or replace any strings.
These are more like usages than syntaxes but we can use it like these:
- num.expr1 is the starting position for the operation.
- It refers to the character position where the replacement or extraction operation occurs.
- num.expr2 is the number of characters involved in the operation.
- For an extraction, UniData returns that number of characters.
- For a replacement, UniData replaces that number of characters.
str.expr [num.expr1,num.expr2] = expr
In the usage above, the square bracket function replaces part or all of str.expr.
expr = str.expr [num.expr1, num.expr2]
In the usage above, the square bracket function extracts part or all of string.expr.
expr = str.expr [num.expr1]
In the first form, the function replaces part or all of string.expr. In the
second form, the function extracts part or all of string.expr
When a null value is passed a command parameter where a number is expected for e.g (num.expr1, num.expr2) and if you have null value handling ON, you’ll get a warning message and UniBasic will use 0 as the value.
Extract the first character of the variable
F.INITIAL will have “S” stored as its value.
FIRST.NAME = 'Sam' F.INITIAL = FIRST.NAME[1,1]
Change the first letter of the word
The resulting string will be “Merry Christmas”.
TITLE = 'Merry Xhristmas' TITLE[7,1] = 'C'
colleague examples functions how to studio