Skip to content

String Functions

Paul Squires edited this page Sep 19, 2026 · 1 revision

Home › String Functions › String Functions

String Functions

Statements and Procedures that work with strings.

Description

These statements and procedures provide many ways to create and manipulate strings and substrings. Numbers can be converted to strings and vice-versa. Procedures are also provided to aid in serialization of numeric data, perhaps for persistent storage.

Creating Strings

String data types and procedures that create new strings.

Character Conversions

Procedures that convert from character codes to strings and back.

Numeric/Boolean to String Conversions

Procedures that convert numeric values to strings.

String to Numeric Conversions

Procedures that convert strings to numeric values.

Numeric Serializations

Procedures that convert raw numeric data to and from strings suitable for storage.

Working with Substrings

Procedures that return subsets of strings, or that modify subsets of strings.

Creating Strings

String

Standard data type: 8 bit character string.

String (Function)

Returns a String of multiple characters.

ZString

Standard data type: null terminated 8 bit character string.

WString

Standard data type: wide character string.

Wstring (Function)

Returns a WString of multiple characters.

Space

Returns a String consisting of spaces.

WSpace

Returns a WString consisting of spaces.

Len

Returns the length of a string in characters.

Character Conversion

Asc

Returns an Integer representation of an character.

Chr

Returns a string of one or more characters from their ASCII Integer representation.

WChr

Returns a WString of one or more characters from their Unicode Integer representation.

Numeric/Boolean to String Conversions

Bin

Returns a binary String representation of an integral value.

WBin

Returns a binary WString representation of an integral value.

Hex

Returns a hexadecimal String representation of an integral value.

WHex

Returns a hexadecimal WString representation of an integral value.

Oct

Returns an octal String representation of an integral value.

WOct

Returns an octal WString representation of an integral value.

Str

Returns the String representation of numeric value or boolean.

WStr

Returns the WString representation of numeric value.

Format

Returns a formatted String representation of a Double.

String to Numeric Conversions

Val

Returns the Double conversion of a numeric string.

ValInt

Returns the Integer conversion of a numeric string.

ValLng

Returns the Long conversion of a numeric string.

ValUInt

Returns the UInteger conversion of a numeric string.

ValULng

Returns the ULong conversion of a numeric string.

Numeric Serialization

MKD

Returns an eight character String representation of a Double.

MKI

Returns a four character String representation of a Integer.

MKL

Returns a four character String representation of a Long.

MKLongInt

Returns an eight character String representation of a LongInt.

MKS

Returns a four character String representation of a Single.

MKShort

Returns a two character String representation of a Short.

CVD

Returns a Double representation of an eight character String.

CVI

Returns an Integer representation of a four character String.

CVL

Returns a Long representation of a four character String.

CVLongInt

Returns a LongInt representation of an eight character String.

CVS

Returns a Single representation of a four character String.

CVShort

Returns a Short representation of a two character String.

Working with Substrings

Left

Returns a substring of the leftmost characters in a string.

Mid (Function)

Returns a substring of a string.

Right

Returns a substring of the rightmost characters in a string.

LCase

Returns a copy of a string converted to lowercase alpha characters.

UCase

Returns a copy of a string converted to uppercase alpha characters.

LTrim

Removes surrounding substrings or characters on the left side of a string.

RTrim

Removes surrounding substrings or characters on the right side of a string.

Trim

Removes surrounding substrings or characters on the left and right side of a string.

InStr

Returns the first occurrence of a substring or character within a string.

InStrRev

Returns the last occurrence of a substring or character within a string.

Mid (Statement)

Copies a substring to a substring of a string.

LSet

Left-justifies a string.

RSet

Right-justifies a string.


Category: String Functions


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally