411 REFERENCE · Wikibooks
Futurebasic/language/string expressions
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
String Expressions
Revised for FBtoC 15 February 2008
Description
A string expression is anything that can be evaluated as a string of 0 to 255 characters. (Note that FutureBASIC also provides "Containers" with 2GB text capacity that operate very similarly to a standard string). A string can be expressed in any of the following ways:
Simple Expressions
<li type="disc">A string literal, or a string variable. See Appendix C: Data types and Data Representation, for more information.
Examples: surname$(23) "Friday"
<li type="disc">A reference to any user-defined function that returns a string value. Example: fn MyStringFunc$( "something" )
<li type="disc">A value returned by any built-in FB function whose name ends with $ Examples: chr$( 7 ) hex$( z& )
<li type="disc">A value returned by the using function, or by the str# function. Examples: using "##.#"; pi str#( 130, 5 )
Compound Expressions
A compound string expression is a list of simple string expressions separated by the concatenation operator "+". The syntax of a compound string expression is:
simpleExpr1 + simpleExpr2 [+ simpleExpr3 ...]
The "+" operator builds a longer string by concatenating the operands. For example:
"Ex" + "tra" + mid$( "fiction", 3 )
This expression has the value "Extraction".
Notes
If a string expression is assigned to a string variable too small to hold it, the expression is silently truncated to fit.
When two string expressions are separated by a data-comparison operator (==, !=, <, >) the result is a numeric expression. See Appendix D: Numeric Expressions.