Casio FX-CG20 Calculator User Manual


 
CASIO
8-25
k Strings
A string is a series of characters enclosed in double quotes. In a program, strings are used
to specify display text. A string made up of numbers (like "123") or an expression (like "
x –1")
cannot be processed as a calculation.
To display a string at a specific location on the screen, use the Locate command (page 8-23).
• To include double quotes (") or a backslash (\) in a string, put a backslash (\) in front of the
double quotes (") or backslash (\).
Example 1: To include Japan: “Tokyo” in a string
"Japan:\"Tokyo\""
Example 2: To include main\abc in a string
"main\\abc"
You can input a backslash from the menu that appears when you press 6(CHAR)
2(SYMBOL) in the Program mode, or from the String category of the catalog that appears
when you press !e(CATALOG).
• You can assign strings to string memory (Str 1 through Str 20). For details about strings, see
“String Memory” (page 2-8).
• You can use the “+” command (page 8-27) to connect strings inside of an argument.
• A function or command within a string function (Exp(, StrCmp(, etc.) is treated as a single
character. For example, the “sin” function is treated as a single character.
Exp(
Function: Converts a string to an expression, and executes the expression.
Syntax: Exp("<string>"[)]
Exp
'
'Str(
Function: Converts a graph expression to a string and assigns it to the specified variable.
Syntax: Exp 'Str(<formula>, <string variable name>[)]
Description: A graph expression (Y
n
, r, X
t
, Y
t
, X), recursion formula ( a
n
, a
n
+1
, a
n
+2
, b
n
, b
n
+1
, b
n
+2
,
c
n
, c
n
+1
, c
n
+2
), or function memory (f
n
) can be used as the first argument (<formula>).
StrCmp(
Function: Compares “<string 1>” and “<string 2>” (character code comparison).
Syntax: StrCmp("<string 1>", "<string 2>"[)]
Description: Compares two strings and returns one of the following values.
Returns 0 when “<string 1>” = “<string 2>”.
Returns 1 when “<string 1>” > “<string 2>”.
Returns –1 when “<string 1>” < “<string 2>”.