UNPKG

vite-uni-dev-tool

Version:

vite-uni-dev-tool, debug, uni-app, 一处编写,到处调试

70 lines 2.87 kB
/** * 将匹配到的字符串高亮显示 * * @export * @param {string} [str=''] * @param {string} [search=''] * @return {*} */ export declare function hightLight(str?: string, search?: string): string; export declare function escapeHTML(unsafe: string): string; /** * 在字符串中获取url * * @export * @param {string} text * @return {*} */ export declare function extractUrl(text: string): string; /** * 获取url 中末尾的行号和列号 * * @export * @param {string} url * @return {*} */ export declare function extractRowAndCol(url: string): { row: number; col: number; }; /** * 解析栈信息 * * @export * @param {string} stack * @return {*} */ export declare function parseStock(stack: string): { info: string; path: string; row: number; col: number; }; export declare function isMockWX(stack: string): boolean; export declare function uniqueId(pre?: string, length?: number, chars?: string): string; /** * 将字符串的url拆分出来 * * @example "这是链接:http://example.com" => [{type: 'string', value: '这是链接:'}, {type: 'link', value: 'http://example.com'}]" * @example "这是链接:https://example.com" => [{type: 'string', value: '这是链接:'}, {type: 'link', value: 'https://example.com'}]" * @example "这是链接:www.example.com" => [{type: 'string', value: '这是链接:'}, {type: 'link', value: 'www.example.com'}]" * @example "这是链接:http://example.com这是链接:http://example.com" => [{type: 'string', value: '这是链接:'}, {type: 'link', value: 'http://example.com这是链接:http://example.com'}]" * @example "这是图片<img src='https://example.com/image.jpg'>" => [{type: 'string', value: '这是图片<img src='}, {type: 'link', value: 'https://example.com/image.jpg'}, {type: 'string', value: "'>""}] * @example "这是图片<img src='https://example.com/image.jpg'>这是图片<img src='https://example.com/image.jpg'>" => [{type: 'string', value: '这是图片<img src='}, {type: 'link', value: 'https://example.com/image.jpg'}, {type: 'string', value: "'>这是图片<img src='"}, {type: 'link',value: 'https://example.com/image.jpg'}, {type: 'string', value: "'>"}}] * @example "这是链接<a href='https://example.com'>点击我</a>" => [{type: 'string', value: '这是链接<a href='}, {type: 'link', value: 'https://example.com'}, {type: 'string', value: "'>点击我</a>"}]] * * * @export * @param {string} str * @return {*} {({ type: 'string' | 'link'; value: string }[])} */ export declare function splitStrByUrl(str: string): { type: 'string' | 'link'; value: string; }[]; /** * 判断字符串中是否包含url * http|https|www */ export declare function hasUrl(str: string): boolean; //# sourceMappingURL=string.d.ts.map