/** * Core string manipulation functions */ /** * Converts string to camel case. * * @param string - The string to convert * @returns Returns the camel cased string * * @example * camelCase('Foo Bar'); * // => 'fooBar' * * camelCase('--foo-bar--'); * // => 'fooBar' * * camelCase('__FOO_BAR__'); * // => 'fooBar' */ export declare function camelCase(string?: string): string; /** * Converts the first character of string to upper case and the remaining * to lower case. * * @param string - The string to capitalize * @returns Returns the capitalized string * * @example * capitalize('FRED'); * // => 'Fred' */ export declare function capitalize(string?: string): string; /** * Deburrs string by converting Latin-1 Supplement and Latin Extended-A * letters to basic Latin letters and removing combining diacritical marks. * * @param string - The string to deburr * @returns Returns the deburred string * * @example * deburr('déjà vu'); * // => 'deja vu' */ export declare function deburr(string?: string): string; /** * Checks if string ends with the given target string. * * @param string - The string to inspect * @param target - The string to search for * @param position - The position to search up to * @returns Returns true if string ends with target, else false * * @example * endsWith('abc', 'c'); * // => true * * endsWith('abc', 'b'); * // => false * * endsWith('abc', 'b', 2); * // => true */ export declare function endsWith(string?: string, target?: string, position?: number): boolean; /** * Converts the characters "&", "<", ">", '"', and "'" in string to their * corresponding HTML entities. * * @param string - The string to escape * @returns Returns the escaped string * * @example * escape('fred, barney, & pebbles'); * // => 'fred, barney, & pebbles' */ export declare function escape(string?: string): string; /** * Escapes the RegExp special characters "^", "$", "\\", ".", "*", "+", * "?", "(", ")", "[", "]", "{", "}", and "|" in string. * * @param string - The string to escape * @returns Returns the escaped string * * @example * escapeRegExp('[lodash](https://lodash.com/)'); * // => '\\[lodash\\]\\(https://lodash\\.com/\\)' */ export declare function escapeRegExp(string?: string): string; /** * Converts string to kebab case. * * @param string - The string to convert * @returns Returns the kebab cased string * * @example * kebabCase('Foo Bar'); * // => 'foo-bar' * * kebabCase('fooBar'); * // => 'foo-bar' * * kebabCase('__FOO_BAR__'); * // => 'foo-bar' */ export declare function kebabCase(string?: string): string; /** * Converts string, as space separated words, to lower case. * * @param string - The string to convert * @returns Returns the lower cased string * * @example * lowerCase('--Foo-Bar--'); * // => 'foo bar' * * lowerCase('fooBar'); * // => 'foo bar' * * lowerCase('__FOO_BAR__'); * // => 'foo bar' */ export declare function lowerCase(string?: string): string; /** * Converts the first character of string to lower case. * * @param string - The string to convert * @returns Returns the converted string * * @example * lowerFirst('Fred'); * // => 'fred' * * lowerFirst('FRED'); * // => 'fRED' */ export declare function lowerFirst(string?: string): string; /** * Pads string on the left and right sides if it's shorter than length. * Padding characters are truncated if they can't be evenly divided by length. * * @param string - The string to pad * @param length - The padding length * @param chars - The string used as padding * @returns Returns the padded string * * @example * pad('abc', 8); * // => ' abc ' * * pad('abc', 8, '_-'); * // => '_-abc_-_' * * pad('abc', 3); * // => 'abc' */ export declare function pad(string?: string, length?: number, chars?: string): string; /** * Pads string on the right side if it's shorter than length. * Padding characters are truncated if they exceed length. * * @param string - The string to pad * @param length - The padding length * @param chars - The string used as padding * @returns Returns the padded string * * @example * padEnd('abc', 6); * // => 'abc ' * * padEnd('abc', 6, '_-'); * // => 'abc_-_' * * padEnd('abc', 3); * // => 'abc' */ export declare function padEnd(string?: string, length?: number, chars?: string): string; /** * Pads string on the left side if it's shorter than length. * Padding characters are truncated if they exceed length. * * @param string - The string to pad * @param length - The padding length * @param chars - The string used as padding * @returns Returns the padded string * * @example * padStart('abc', 6); * // => ' abc' * * padStart('abc', 6, '_-'); * // => '_-_abc' * * padStart('abc', 3); * // => 'abc' */ export declare function padStart(string?: string, length?: number, chars?: string): string; /** * Converts string to an integer of the specified radix. If radix is * undefined or 0, a radix of 10 is used unless value is a hexadecimal, * in which case a radix of 16 is used. * * @param string - The string to convert * @param radix - The radix to interpret value by * @returns Returns the converted integer * * @example * parseInt('08'); * // => 8 * * map(['6', '08', '10'], parseInt); * // => [6, 8, 10] */ export declare function parseInt(string: string, radix?: number): number; /** * Repeats the given string n times. * * @param string - The string to repeat * @param n - The number of times to repeat the string * @returns Returns the repeated string * * @example * repeat('*', 3); * // => '***' * * repeat('abc', 2); * // => 'abcabc' * * repeat('abc', 0); * // => '' */ export declare function repeat(string?: string, n?: number): string; /** * Replaces matches for pattern in string with replacement. * * @param string - The string to modify * @param pattern - The pattern to replace * @param replacement - The match replacement * @returns Returns the modified string * * @example * replace('Hi Fred', 'Fred', 'Barney'); * // => 'Hi Barney' * * replace('123-456-789', /(\d{3})-(\d{3})-(\d{4})/, '($1) $2-$3'); * // => '(123) 456-789' */ export declare function replace(string?: string, pattern?: string | RegExp, replacement?: string): string; /** * Converts string to snake case. * * @param string - The string to convert * @returns Returns the snake cased string * * @example * snakeCase('Foo Bar'); * // => 'foo_bar' * * snakeCase('fooBar'); * // => 'foo_bar' * * snakeCase('--FOO-BAR--'); * // => 'foo_bar' */ export declare function snakeCase(string?: string): string; /** * Splits string by separator. * * @param string - The string to split * @param separator - The separator pattern to split by * @param limit - The length to truncate results to * @returns Returns the string segments * * @example * split('a-b-c', '-', 2); * // => ['a', 'b'] */ export declare function split(string?: string, separator?: string | RegExp, limit?: number): string[]; /** * Converts string to start case. * * @param string - The string to convert * @returns Returns the start cased string * * @example * startCase('--foo-bar--'); * // => 'Foo Bar' * * startCase('fooBar'); * // => 'Foo Bar' * * startCase('__FOO_BAR__'); * // => 'FOO BAR' */ export declare function startCase(string?: string): string; /** * Checks if string starts with the given target string. * * @param string - The string to inspect * @param target - The string to search for * @param position - The position to search from * @returns Returns true if string starts with target, else false * * @example * startsWith('abc', 'a'); * // => true * * startsWith('abc', 'b'); * // => false * * startsWith('abc', 'b', 1); * // => true */ export declare function startsWith(string?: string, target?: string, position?: number): boolean; /** * Creates a compiled template function that can interpolate data properties * in "interpolate" delimiters, HTML-escape interpolated data properties in * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. * * @param string - The template string * @param options - The options object * @returns Returns the compiled template function * * @example * const compiled = template('hello <%= user %>!'); * compiled({ 'user': 'fred' }); * // => 'hello fred!' */ export declare function template(string?: string, options?: { interpolate?: RegExp; evaluate?: RegExp; escape?: RegExp; variable?: string; }): (data?: any) => string; /** * Converts string, as space separated words, to upper case. * * @param string - The string to convert * @returns Returns the upper cased string * * @example * upperCase('--foo-bar'); * // => 'FOO BAR' * * upperCase('fooBar'); * // => 'FOO BAR' * * upperCase('__foo_bar__'); * // => 'FOO BAR' */ export declare function upperCase(string?: string): string; /** * Converts the first character of string to upper case. * * @param string - The string to convert * @returns Returns the converted string * * @example * upperFirst('fred'); * // => 'Fred' * * upperFirst('FRED'); * // => 'FRED' */ export declare function upperFirst(string?: string): string; /** * Splits string into an array of its words. * * @param string - The string to inspect * @param pattern - The pattern to match words * @returns Returns the words of string * * @example * words('fred, barney, & pebbles'); * // => ['fred', 'barney', 'pebbles'] * * words('fred, barney, & pebbles', /[^, ]+/g); * // => ['fred', 'barney', '&', 'pebbles'] */ export declare function words(string?: string, pattern?: string | RegExp): string[];