Skip to main content
Latest
function stringHelper.getObjectByOperators
import { stringHelper } from "https://deno.land/x/m_utils@v1.0.5/mod.ts";
const { getObjectByOperators } = stringHelper;

根据拆分符号列表对数据进行拆分

Examples

Example 1

 stringHelper.getObjectByOperators('b=2&a=1', '&', '=')
 // { b: "2", a: "1" }

 stringHelper.getObjectByOperators('b=2+d&a=1+c=3', '', '&', '+', '=')
 // { b: "2", a: "1", c: "3" }

Parameters

str: string

参数字符串

...operators: string[]

Returns

Record<string, unknown> | null

包装后的对象