CasewareDocs

FormatString

Replaces arguments/placeholders in a given string.

Compatibility

Available as of IDEA version 9.0

Syntax

FormatString(inputString as String, values as Variant) as String

Parameters

inputString

This string contains placeholders which will be replaced by values.

values

The values which will replace the placeholders.

Return Value

A string which contains placeholders like {0}, {1} ... will be filled with the values given.

Example

Dim SimpleCommands As Object 
Dim inputString As String
Dim outputString As String
Dim LS As String

Sub Main
Set SimpleCommands = SmartContext.MacroCommands.SimpleCommands

'Get list separator.
LS = SimpleCommands.ListSeparator

'Defines inputString
inputString = "@Between({1}{0}{2}{0}{3})"
'Construction of outputString - the equation "@Between(JE_NR,2000,2999)"
'LS, "JE_NR", "2000", "2999", are the values for placeholders.

outputString = SimpleCommands.FormatString(inputString, LS, "JE_NR", "2000", "2999")

'Release object.
Set SimpleCommands = Nothing
End Sub
FormatString | Caseware Docs