<< Click to Display Table of Contents >> Navigation: 1. Starting Guides > 1. Starting Guide |
Starting Guide
Working with text strings
How do you analyze and synthesize text-strings,
What is a text string?
We have two kinds of strings in our daily IT-work:
1. Text-strings - these are mostly letters, linefeeds. Text-Strings are, waht you see in textfiles.
2. Binary strings - this strings can contain any of the ASC-Characters 0 to 255
When dealing with Binary strings, you need to be careful, as they may accidentally contain sequences that could be interpreted by the robot-system. This can be variable names as well as special folders or system-variables.
Therefore you should only use commands that do a "one time resolution". These commands will just replace the variable-name of the binary string with the string and they will not touch the inside.
This way you can deal with both types of strings if you know that, and use only commands that are suitable for the specific case.
What can i do with binary strings?
Binary strings can be
• read from disk using CFF. - Copy-From-File
• find about its length using LEN. - Length-of-String
• write them back to disk using CTF - Copy-To-File
• patch them using GSS. - GetSplitString and VAB. - Variable Binary
• Replace part of it using RPL. - RePLace in String
• They can be encrypted and decrypted using GEC. - Get Encryption
• you can verify them using a checksum with GMD. - Get Message Digest
• and you can merge them in a package using SIB. - Set-In-Block
• or extract them from a package using GFB. - Get-From-Block
and there is more but these are the most important uses for binary string data.
What can you do with text string?
• read from disk using CFF. - Copy-From-File
• write them back to disk using CTF - Copy-To-File
• read text strings from INI-Files using CFI. - Copy-From_IniFile
• write them back to an INI-File with CTI. - Copy-To-Inifile
• find about its length using LEN. - Length-of-String
• Find out if it contains a substring using IVC. / NVC. - If-Variable-Contains
• Check it against a Standard-Search Pattern with IVP./ NVP. - If-Variable-Pattern
• break it into delimited parts using SBD. - String between Delimiter
• Sort delimited parts of a string using SRT. - Sort Items
• split them using GSS. - GetSplitString and VAR. - Variable Set Value/Clear
• Replace part of it using RPL. - RePLace in String
• They can be encrypted and decrypted using GEC. - Get Encryption
• you can verify them using a checksum with GMD. - Get Message Digest
• and you can merge them in a package using SIB. - Set-In-Block
• or extract them from a package using GFB. - Get-From-Block
• work with a file path using GFT. - Get-File-Token
• or use regular expression
with GRE. - Get Regular Expressio and GRR. - Get Regular Replace
and much more!
Let us look at some examples on how to deal with strings.
How do we define a Textstring?
Its as easy as this:
: $$TXT=Hello world!
this sequence defines a Test-String.
In the same way, you can use the VAR. - Variable Set Value/Clear
command to define a text string.
VAR.$$TXT=Hello world!
There is no difference between these two.While you can also just leave the : away and write:
$$TXT=Hello world! $crlf$It's $date$ today.
which will do all the same.
THere are other commands to define variables.
VAB. for example will not resolve 3.1 Systemvariables or 3.3 Specialfolders but just leave the variable content as it is. The second form will do that. Let's see the difference in a practical example:
' Will NOT resolve specialfolders,systemavariables etc.
VAR.$$TXT=Hello world! $crlf$It's $date$ today.
DBV.$$TXT
' Will resolve specialfolders,systemavariables etc.
VAB.$$TXT=Hello world! $crlf$It's $date$ today.
DBV.$$TXT
MBX.READY
And this is the output in the Editor Debug-window:
As expected, VAR. has resolved the system-variables and the VAB. did not.
Note that we use DBV. here, and not DBP. Because DBP. itself will resolve all specialfolder and system-variables. Then we would not been able to see the difference.
Why do we need this difference?
It's mostly to protect your code from unwanted code-changes. There is no real speed penalty when using VAR..
Note that the ":"-Definition Operator still resolves variable names. It does not make a binary compatible resolution (suitable for binary strings) like VAB. - Variable Binary .
' Will NOT resolve specialfolders,systemavariables but
' will resolve variable names!
: $$TXT=Hello world! $crlf$It's $date$ today.
: $$TXT=$$TXT $$TXT
DBV.$$TXT
•IVB. / NVB. - If Variable Between
•IVC. / NVC. - If-Variable-Contains
•IVP./ NVP. - If-Variable-Pattern
•IVS. / NVS. - If-Variable-String
•IVV. / NVV. - If Variable Value
•IWC. / NWC. - If Wildcard Pattern
•VAO. - Variable Once / Variable Clear
•VAR. - Variable Set Value/Clear
•VAV. - Variables with Variables
•VBA. - Variable Binary Append
•VFP. - Variable Floating Point