Navigation:  thinBasic Modules > Core > String handling >

EXPAND$

Previous pageReturn to chapter overviewNext page

 

Description

 

Check whether a string contains a script variable name mark ($ followed by variable name) and substitute with variable value.

If variable name mark will be found, its position will be expanded (substituted) using current variable content.

 

Syntax

 

s = EXPAND$(sMainString)

 

Returns

 

String

 

Parameters

 

Name

Type

Optional

Meaning

sMainString

String

No

Main string to check for variable names

 

Remarks

 

sMainString will be searched for $ variable placeholders.

Variable placeholders must be followed by the name of the variable to be expanded. See example below.

 

Restrictions

 

Only simple numeric and string variables are supported.

No arrays, no UDT elements are supported.

 

See also

 

Examples

 

 

Dim MyLong   As Long Value 123

Dim MyString As String = "Value of MyLong is: $MyLong"

 

MsgBox 0, EXPAND$(MyString)