Skip to content

Home > sculp-js > replaceVarFromString

replaceVarFromString() function

替换字符串中的插值变量

Signature:

typescript
export declare function replaceVarFromString(sourceStr: string, targetObj: Record<string, any>, leftMatchSymbol?: string, rightMatchSymbol?: string): string;

Parameters

Parameter

Type

Description

sourceStr

string

targetObj

Record<string, any>

leftMatchSymbol

string

(Optional) 变量左侧匹配符号,默认:{

rightMatchSymbol

string

(Optional) 变量右侧匹配符号,默认:}

Returns:

string

string

Released under the MIT License.