Skip to main content

Format-String

Command Description

Support formatting strings with placeholder

Command Prototype

sRet = Format(sText,repText1,repText2)

Parameter Description

ParameterRequiredTypeDefaultDescription
sTextTruestring"%d %s"Strings containing placeholders follow the rules of the C library command sprintf: %[flags][width][.precision][length]specifier, but *, h, L, l, n, and p are not supported; "%q" is newly added to encapsulate the target string with double quotation marks; "%%" means "escape", and cannot work as a placeholder
repText1Truenumber1Only one replacement value can be entered, and the sequence directly corresponds to the sequence of placeholders in the format string
repText2Truestring"Laiye RPA"Only one replacement value can be entered, and the sequence directly corresponds to the sequence of placeholders in the format string

return

sRet,The variable used to save the output of the command.

Demo

TracePrint("----------------------Format string---------------------- ---") 
//-------------------------------------------------------------------------------
//[Remarks] Supports formatting strings in the form of placeholders.
//Input parameter 1:
// sText--A string containing placeholders.
//Input parameter 2:
// repText1--A replacement value corresponding to the sequence of placeholders in the format string.
//Input parameter 3:
// repText2--a replacement value corresponding to the sequence of placeholders in the format string.
//out parameters:
// sRet--The variable to which the output of the function call is saved.
//
//Command prototype: sRet=Format(sText,repText1,repText2)
//-------------------------------------------------------------------------------
sRet = Format ("UiBot%d%s", 1, "Laiye RPA")
TracePrint (sRet)