Scripter Javascript Tutorial
javascriptmusiclogicscripterbookexcerpttutorial18 String
A String
is a series of characters of any length,
including no characters, when wrapped in double or single quotes. In
Scripter, strings are primarily used to manage parameter controls and
debugging.
var controlName = "Tonic";
var emptyString = "";
Strings can be combined with any other data type with the
“+
” operator. When numbers are combined with strings,
numbers are automatically converted into strings.
var string1 = "foo"; // double quotes
var string2 = 'bar'; // single quotes
var aNumber = 1;
var result = string1 + string2 + aNumber; // "foobar1";
Simple formatting for strings is provided with the tab
“\t
” and line break “\n
” characters:
var tab = "\tfoo";
var linebreak = "foo\nbar"; // single quotes
Trace(tab);
Trace(linebreak);
***Creating a new MIDI engine with script***
Evaluating MIDI-processing script...
Script evaluated successfully!
foo
foo
bar
>
If a back slash \
is needed in a String, then another
back slash is used to “escape” it:
var second_dom = "V\\V"; // "V\V"