MoneyWorks Manual
Constants
The simplest example of an expression is a simple constant, such as:
"A text string" 457.50 '21/2/68' #7000000
There are four different kinds of constants —string, numeric, date and hexadecimal constants. These are shown respectively above. Notice that a string constant must be enclosed in double quotation marks (or inch symbols), a date constant is enclosed in single quotation marks (or foot symbols), and a hexadecimal constant starts with a # symbol. If the string constant were not enclosed in quotes, the expression parser would treat each word as if it were an identifier.
Escape sequences
To include a character in a string constant which you could not otherwise include, you need to use an escape sequence. An escape sequence consists of a pair of characters made from the escape character \ (backslash), followed by the escape metacharacter for the character that you want. The metacharacters used by MoneyWorks are " (quote or inch symbol), t, n and \. Their use is shown in the table below:
Character | Esc. Seq. | Example |
quote | \" | "He said \"Fiddlesticks\"" |
tab | \t | "Column1\tColumn2\tColumn3" |
newline | \n | "This is line 1\nThis is line 2" |
return | \r | "The \r of the native" |
backslash | \\ | "The backslash \\ is a special character" |
As an example, to replace all commas in a string with newlines, you would use an expression such as:
Replace(theString, ",", "\n")
As well as the double quotation marks for delimiting strings, you can use the backquote, e.g.
Replace(theString, `,`, "\n")
Having two string delimiters means that you don’t have to use the escape sequence for expressions that involved embedded strings.
Note: Don't confuse the backquote ` with the apostrophe ' — the latter is used to delimit dates.