import Point from '../../geo/Point'; import Size from '../../geo/Size'; /** * @classdesc * Utilities methods for Strings used internally. It is static and should not be initiated. * @class * @static * @category core * @name StringUtil */ export declare const EMPTY_STRING = ""; /** * Trim the string * @param str * @return * @memberOf StringUtil */ export declare function trim(str: string): string; export declare function replaceAll(str: string, key: string, value: string): string; /** * Escape special characters from string. * Including: \b \t \r \v \f * @param str string to escape * @return * @memberOf StringUtil */ export declare function escapeSpecialChars(str: string): string; /** * Split string by specified char * @param chr - char to split * @return * @memberOf StringUtil */ export declare function splitWords(chr: string): string[]; /** * Gets width of the text with a certain font. * More performant than stringLength. * @param text - text to measure * @param font - font of the text, same as the CSS font. * @return * @memberOf StringUtil */ export declare function stringWidth(text: string, font?: string): number; /** * Gets size in pixel of the text with a certain font. * @param text - text to measure * @param font - font of the text, same as the CSS font. * @return * @memberOf StringUtil */ export declare function stringLength(text: string, font: string, size?: number): Size; /** * Split text content by dom. * @param content - content to split * @param font - font of the text, same as the CSS font. * @return wrapWidth - width to wrap * @return {String[]} * @memberOf StringUtil */ export declare function splitContent(content: string, font: string, wrapWidth: number, textWidth: number): any[]; /** * Replace variables wrapped by square brackets ({foo}) with actual values in props. * @example * // will returns 'John is awesome' * const actual = replaceVariable('{foo} is awesome', {'foo' : 'John'}); * @param str - string to replace * @param props - variable value properties * @return * @memberOf StringUtil */ export declare function replaceVariable(str: string, props: Object): string; /** * Generate text descriptors according to symbols * @return {Object} text descriptor * @memberOf StringUtil */ export declare function describeText(textContent: any, symbol: any): { total: number; size: Size; rows: any[]; rawSize: Size; }; /** * Gets text's align point according to the horizontalAlignment and verticalAlignment * @param {Size} size - text size * @param {String} horizontalAlignment - horizontalAlignment: left/middle/right * @param {String} verticalAlignment - verticalAlignment: top/middle/bottom * @return {Point} * @memberOf StringUtil */ export declare function getAlignPoint(size: Size, horizontalAlignment: string, verticalAlignment: string): Point; export declare const DEFAULT_FONT = "sans-serif"; export declare const DEFAULT_TEXTSIZE = 14; /** * Returns CSS Font from a symbol with text styles. * @param {Object} style symbol with text styles * @return {String} CSS Font String * @memberOf StringUtil */ export declare function getFont(style: any): any; /** * Split a text to multiple rows according to the style. * @param {String} text - text to split * @param {Object} style - text style * @return {Object[]} the object's structure: { rowNum: rowNum, textSize: textSize, rows: textRows, rawSize : rawSize } * @memberOf StringUtil */ export declare function splitTextToRow(text: string, style: Object): { total: number; size: Size; rows: any[]; rawSize: Size; }; export declare function hashCode(s: string): number; //# sourceMappingURL=strings.d.ts.map