Skip to content

引入

ts
import { stringFormat } from 't-comm';

// 不支持 tree-shaking 的项目
import { stringFormat} from 't-comm/lib/string-format/index';

// 只支持 ESM 的项目
import { stringFormat} from 't-comm/es/string-format/index';

stringFormat(string, args)

描述:String format template

参数

参数名类型描述
stringstring字符串
argsany填充选项

示例

ts
stringFormat('{{likes}} people have liked this', {
  likes: 123,
});