From 4e41ad78489322e33da916198dbb7b9026c97c83 Mon Sep 17 00:00:00 2001 From: alan Date: Fri, 5 Jul 2019 10:13:26 +0800 Subject: [PATCH] feat: KERNEL-798 core/func/string --- typescript/core/func/string.ts | 13 +++++++++++++ typescript/index.ts | 9 +++++++++ 2 files changed, 22 insertions(+) create mode 100644 typescript/core/func/string.ts diff --git a/typescript/core/func/string.ts b/typescript/core/func/string.ts new file mode 100644 index 000000000..fae4d7d66 --- /dev/null +++ b/typescript/core/func/string.ts @@ -0,0 +1,13 @@ +export declare type _startWith = (str: string, startTag: string) => boolean; + +export declare type _endWith = (str: string, endTag: string) => boolean; + +export declare type _getQuery = (str: string, name: string) => string|null; + +export declare type _appendQuery = (str: string, paras: {[key: string]: string|number}) => string; + +export declare type _replaceAll = (str: string, s1: string, s2: string) => string; + +export declare type _perfectStart = (str: string, start: string) => string; + +export declare type _allIndexOf = (str: string, sub: string) => number[]; diff --git a/typescript/index.ts b/typescript/index.ts index 95723ce61..b3d9cae20 100644 --- a/typescript/index.ts +++ b/typescript/index.ts @@ -1,6 +1,7 @@ import { _addI18n, _i18nText } from "./core/i18n"; import { _OB } from "./core/ob"; import { _pushArray, _pushDistinct, _pushDistinctArray} from "./core/func/array"; +import {_startWith, _allIndexOf, _appendQuery, _endWith, _getQuery, _perfectStart, _replaceAll} from "./core/func/string"; export declare module BI { namespace i18n { @@ -13,4 +14,12 @@ export declare module BI { const pushArray: _pushArray; const pushDistinct: _pushDistinct; const pushDistinctArray: _pushDistinctArray; + + const startWith: _startWith; + const endWith: _endWith; + const allIndexOf: _allIndexOf; + const appendQuery: _appendQuery; + const getQuery: _getQuery; + const perfectStart: _perfectStart; + const replaceAll: _replaceAll; }