2.6.1 String Variables and String Registers
In Origin, string processing is supported in two ways: with string variables, and with string registers. In general, we encourage the use of string variables as they are more intuitive (i.e., more like strings in other programming languages) and are supported by many pre-defined string methods; both of which are advantages over string registers.
String VariablesString Variable
A string variable is created by declaration and/or assignment, and its name is always followed by a $-sign. For example:
// Creates by declaration a variable named 'aa' of the string type;
//'aa' is empty (i.e., "")
// Assigns to 'aa' a character sequence
aa$ = "Happy";
// Creates and assigns a value to string variable 'bb',
//all on the same line
string bb$ = "Yes";
// Creates and assigns a value to string variable 'cc' with no declaration
//(see note below)
cc$ = "Project";
Note: Because string variable cc was not declared, it is given Project scope, which means all routines, functions, or otherwise can see it as long as the project is open. Declared variables aa and bb are given Local (or Session) scope. For more on scope, see Variables and Scope.
String RegistersString Register
Prior to Version 8.0, Origin supported string processing with string registers. As such, they continue to be supported by more recent versions, and you may see them used in script programming examples. There are 26 string registers, corresponding to the 26 letters of the English alphabet, each preceeded by a %-sign, i.e., %A--%Z. They can be assigned a character sequence just like string variables, the differences are in the way they are handled and interpreted, as the examples below illustrate. As a warning, several of the 26 string registers are reserved for system use, most notably, the ranges %C--%I, and %X--%Z. For complete documentation on their use, see String Registers.