You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.2 KiB
63 lines
2.2 KiB
5 years ago
|
/**
|
||
|
* 判断字符串是否已指定的字符串开始
|
||
|
* @param str source字符串
|
||
|
* @param {String} startTag 指定的开始字符串
|
||
|
* @return {Boolean} 如果字符串以指定字符串开始则返回true,否则返回false
|
||
|
*/
|
||
|
export declare type _startWith = (str: string, startTag: string) => boolean;
|
||
|
/**
|
||
|
* 判断字符串是否以指定的字符串结束
|
||
|
* @param str source字符串
|
||
|
* @param {String} endTag 指定的字符串
|
||
|
* @return {Boolean} 如果字符串以指定字符串结束则返回true,否则返回false
|
||
|
*/
|
||
|
export declare type _endWith = (str: string, endTag: string) => boolean;
|
||
|
/**
|
||
|
* 获取url中指定名字的参数
|
||
|
* @param str source字符串
|
||
|
* @param {String} name 参数的名字
|
||
|
* @return {String} 参数的值
|
||
|
*/
|
||
|
export declare type _getQuery = (str: string, name: string) => string | null;
|
||
|
/**
|
||
|
* 给url加上给定的参数
|
||
|
* @param str source字符串
|
||
|
* @param {Object} paras 参数对象,是一个键值对对象
|
||
|
* @return {String} 添加了给定参数的url
|
||
|
*/
|
||
|
export declare type _appendQuery = (str: string, paras: {
|
||
|
[key: string]: string | number;
|
||
|
}) => string;
|
||
|
/**
|
||
|
* 将所有符合第一个字符串所表示的字符串替换成为第二个字符串
|
||
|
* @param str source字符串
|
||
|
* @param {String} s1 要替换的字符串的正则表达式
|
||
|
* @param {String} s2 替换的结果字符串
|
||
|
* @returns {String} 替换后的字符串
|
||
|
*/
|
||
|
export declare type _replaceAll = (str: string, s1: string, s2: string) => string;
|
||
|
/**
|
||
|
* 总是让字符串以指定的字符开头
|
||
|
* @param str source字符串
|
||
|
* @param {String} start 指定的字符
|
||
|
* @returns {String} 以指定字符开头的字符串
|
||
|
*/
|
||
|
export declare type _perfectStart = (str: string, start: string) => string;
|
||
|
/**
|
||
|
* 获取字符串中某字符串的所有项位置数组
|
||
|
* @param str source字符串
|
||
|
* @param {String} sub 子字符串
|
||
|
* @return {Number[]} 子字符串在父字符串中出现的所有位置组成的数组
|
||
|
*/
|
||
|
export declare type _allIndexOf = (str: string, sub: string) => number[];
|
||
|
declare type _string = {
|
||
|
startWith: _startWith;
|
||
|
endWith: _endWith;
|
||
|
getQuery: _getQuery;
|
||
|
appendQuery: _appendQuery;
|
||
|
replaceAll: _replaceAll;
|
||
|
perfectStart: _perfectStart;
|
||
|
allIndexOf: _allIndexOf;
|
||
|
};
|
||
|
export default _string;
|