Xbasic

replace_placeholders_with_argument_values Function

Syntax

s Result = replace_placeholders_with_argument_values(C string ,P args [,L flagCorrectBackTicks ])

Arguments

string

String with placeholders

args

Argument structure with replacement values

flagCorrectBackTicks

Logical

Description

Replaces placeholders (enclosed in curly parens, e.g. {arg1}, {arg2}) in a string with values in a SQL::Arguments object.

Example

dim args as sql::arguments
args.add("arg1","selwyn")
args.add("arg2",now())
args.add("arg3",23)
txt = "hello {arg1}, the time is now {arg2} and the day is {arg3}"
txt2 = replace_placeholders_with_argument_values(txt,args)
 
?txt2
= "hello selwyn, the time is now 01/25/2011 11:00:03 77 am and the day is 23"

See Also