This content describes Snap 11. For Snap 10, the equivalent page will be in Snap 10 help

Next Topic

Book Contents

Book Index

Literal operators

Literal Operators are used to manipulate pieces of text. The texts may be the content of a literal variable or the text equivalent of any other variable (date, code, value etc.). They may be used within literal expressions.

Table of literal operators

Operator

 

Description

:

Concatenation

The operands are two pieces of text. The result is a text string that combines the two. If the value of Q10 is "Apple pie", then "Customer ate ":Q10 gives "Customer ate Apple pie"

You can also express this by inserting the variables within the quotation marks."Customer ate {Q10}"

#

Repeat

The first operand is a piece of text and the second is a quantity. The result is a text string consisting of the piece of text repeated quantity times. For example Q10#3 gives "Apple pieApple pieApple pie"

@

at

Selection

When the first operand is a piece of text and the second operand is a shorter piece of text, this tests if the second operand is included in the first. If the second piece of text is contained within the first, the result is the position that it appears for the first time. If the second piece of text is not present, the result is NR. For example Q10@"pie" would give 7.

When the first operand is a piece of text and the second operand is a number, this tells you which character appears at that position in the text. For example Q10@3 would give "p".

When the first operand is a piece of text and the second operand is a list or range of numeric values, this creates a piece of text made up of the characters specified by the list or range. For example Q10@(1,2,5) would give "Ape".