Yogesh Chauhan's Blog

How to use [] (square brackets) function in Envision Basic?

in Envision Basic on December 24, 2021

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.


Change the first letter of the word

The resulting string will be “Merry Christmas”.

TITLE = 'Merry Xhristmas'
TITLE[7,1] = 'C'

Most Read

#1 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #2 How to add Read More Read Less Button using JavaScript? #3 How to check if radio button is checked or not using JavaScript? #4 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #5 How to uninstall Cocoapods from the Mac OS? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

#Apr 8 JSON.stringify() in JavaScript #Apr 7 Middleware in NextJS #Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface
You might also like these
How to modify navigation menus in WordPress?WordPressHow to create a circle that follows a cursor using JavaScript and CSS?CSSActions vs. Filters: hooks in WordPressWordPressHow to create a new HTML element programmatically using JavaScript?HTMLHow to Use the EXISTS and NOT EXISTS Operator with a Subquery in SQL and MySQL?SQL/MySQLHow to embed YouTube or other video links in WordPress?WordPress