/** * @license * Copyright 厦门乾元盛世科技有限公司 All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file. */ /** * 字符串处理函数工具 * * @author fbchen * @version 1.0 2016-12-02 */ export declare class StringUtils { /** * 是否空白字符串 */ static isBlank(str: string): boolean; /** * 计算字符串的字节长度(一个汉字算2个字节) */ static getByteLength(str: string): number; /** * 是否手机号 */ static isPhoneNo(str: string): boolean; /** * 从字符串中提取年、月、日、时、分、秒,并转换为日期对象 * * @param date 字符串格式数字,目前只支持带“分隔符”的数字日期时间,例如:2016-09-12 23:15:00 * @param pattern 日期格式,请参考@angular/DatePipe的说明 * @return Date */ static parseDate(date: string, pattern: string): Date; /** * 字符串转换成Boolean */ static toBoolean(str: string): boolean; /** * 格式化字符串
* 两种调用方式: * * var template1 = "我是{0},今年{1}了"; * var template2 = "我是{name},今年{age}了"; * var result1 = template1.format("小明", 22); * var result2 = template2.format({name: "小明", age: 22}); * // 两个结果都是"我是小明,今年22了" * * @param {String/Object/Array} args 参数 * @return {String} */ static format(str: string, ...args: any[]): string; }