Please enable JavaScript to view this site.

thinBasic Help Manual

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

 

Description

 

Format a string substituting numeric placeholders with the relative string expressions.

 

Syntax

 

s = StrFormat$(sMainString, StringExpression_1 [, StringExpression_2 [, ...]])

 

Returns

 

String

 

Parameters

 

Name

Type

Optional

Meaning

sMainString

String

No

Main string to be used as template

StringExpression_1

String

Yes

Content of StringExpression_1 will be placed in sMainString substituting placeholder "{1}" (if present)

StringExpression_2

String

Yes

Content of StringExpression_2 will be placed in sMainString substituting placeholder "{2}" (if present)

StringExpression_...

String

Yes

...

 

Remarks

 

Any number of StringExpression_... can be indicated.

 

Restrictions

 

See also

 

String Handling,

 

Examples

 

Dim sMainString As String

Dim OutString   As String

 

'----------------------------

sMainString = "Hi all. {1} text is created with new {3} function called {2}"

OutString = StrFormat$(sMainString, "This""StrFormat$""thinBasic")

'---Output will be:

'   'Hi all. This text is created with new thinBasic function called StrFormat$'

MSGBOX 0, OutString

 

'----------------------------

sMainString = "Test with numbers: SIN of {1} is {2}"

OutString = StrFormat$(sMainString, 123, SIN(123))

MSGBOX 0, OutString

 

'----------------------------

sMainString = "Multiple strings repeated: {1}, {2}, {3}, {2}, {1}"

OutString = StrFormat$(sMainString, "A""B""C")

MSGBOX 0, OutString

 

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software