import { CharAt, CountInString, EndsWith, Includes, IndexOf, LeftOf, MakeEndsWith, MakeStartsWith, MidOf, PadStart, RemovePrefix, Replace, ReplaceOne, RightOf, StartsWith, Substring, Trim, Truncate } from '../types/String'; import { List } from 'ts-toolbelt/out/List/List'; import { Join } from 'ts-toolbelt/out/String/Join'; import { Split } from 'ts-toolbelt/out/String/Split'; import { Literal } from 'ts-toolbelt/out/String/_Internal'; import { Mutable } from 'utility-types'; /** * replaces the first occurrence of `find` with `replace` */ export declare const replaceOne: (str: Str, find: Find, replace: ReplaceWithString) => ReplaceOne; /** * replaces all occurrences of `find` in the given string with `replace` */ export declare const replaceAll: (str: Str, find: Find, replace: ReplaceWithString) => Replace; /** * better version of {@link String.prototype.match} that doesn't allow for empty match arrays * * useful when using the `noUncheckedIndexedAccess` compiler option * @see https://github.com/microsoft/TypeScript/issues/42296 */ export declare const match: (str: string, regex: RegExp) => (RegExpMatchArray & [string]) | null; /** * gets the character at the given `index` at compiletime */ export declare const charAt: (string: T, index: I) => CharAt; /** * does {@link String.substring} but at compiletime */ export declare const substring: (string: Str, start: StartIndex, end: EndIndex) => Substring; /** * concatenates strings while keeping their values known at compiletime * @example * const foo = concatenate('foo', 'bar', 'baz') //'foobarbaz' */ export declare const concatenate: (...strings: T) => Join; /** * joins a string by the given `delimiter` at compiletime */ export declare const join: , D extends string>(items: T, delimiter: D) => Join, D>; /** * splits a string by the given `delimiter` at compiletime */ export declare const split: (string: T, delimiter: D) => Split; /** * does {@link String.indexOf} but at compiletime */ export declare const indexOf: (string: Str, substring: Substring_1) => IndexOf; /** * does {@link String.includes} but at compiletime */ export declare const includes: (string: Str, substring: Substring_1) => Includes; /** * does {@link String.padStart} at compiletime */ export declare const padStart: (string: Str, length: Size, padString?: PadString | undefined) => PadStart; /** * {@link String.startsWith} at compile-time */ export declare const startsWith: (full: Full, checkStart: CheckStart) => StartsWith; /** * {@link String.endsWith} at compile-time */ export declare const endsWith: (full: Full, checkEnd: CheckEnd) => EndsWith; declare const defaultEllipsis = "\u2026"; /** * truncates a string to the specified `maxLength`, concatenating an `ellipsis` if the string is too long. * values are preserved at compiletime where possible * @example * const foo = truncate('foobarbaz', 4) // 'foo…' * const bar = truncate('foobarbaz', 4, '--') // 'fo--' */ export declare const truncate: { (string: Str, maxLength: MaxLength, ellipsis: Ellipsis): Truncate; (string: Str, maxLength: MaxLength): Truncate; }; /** * if the given `str` doesn't already start with the given `prefix`, then append the prefix to the start of the string. * * if the `str` already starts with the `prefix`, then returns the string as is * @example * makeStartsWith('foo', '.') // '.foo' * makeStartsWith('.foo', '.') // '.foo' */ export declare const makeStartsWith: (str: Str, prefix: Prefix) => MakeStartsWith; /** * if the given `str` doesn't already end with the given `suffix`, then append the suffix to the end of the string. * * if the `str` already ends with the `suffix`, then returns the string as is * @example * makeEndsWith('foo', '.') // 'foo.' * makeEndsWith('foo.', '.') // 'foo.' */ export declare const makeEndsWith: (str: Str, suffix: Suffix) => MakeEndsWith; /** * gets the string to the left of the given `substring` * @example * leftOf('foo.bar', '.') //'foo' */ export declare const leftOf: (str: Str, substring: Substring_1) => LeftOf; /** * gets the string to the right of the given `substring` * @example * rightOf('foo.bar', '.') //'bar' */ export declare const rightOf: (str: Str, substring: Substring_1) => RightOf; /** * gets the string between the given `start` and `end` strings * @example * midOf('foo(bar)baz', '(', ')') //'bar' */ export declare const midOf: (str: Str, start: Start, end: End) => MidOf; /** * counts how many instances of the given `substring` are in `str` * @example * countInString('1,2,3,4', ',') //3 */ export declare const countInString: (str: Str, substring: Substring_1) => CountInString; /** wrapper for {@link String.toLowerCase} that returns a {@link Lowercase} of the given `value` */ export declare const toLowerCase: (value: T) => Lowercase; /** wrapper for {@link String.toUpperCase} that returns a {@link Uppercase} of the given `value` */ export declare const toUpperCase: (value: T) => Uppercase; /** converts the first character of a string to uppercase */ export declare const capitalize: (value: T) => Capitalize; /** converts the first character of a string to lowercase */ export declare const uncapitalize: (value: T) => Uncapitalize; /** does {@link String.trim} at compiletime */ export declare const trim: (value: T) => Trim; /** * removes the specified `prefix` from `value` if it starts with `prefix`. otherwise returns the `value` as is */ export declare const removePrefix: (value: T, prefix: Prefix) => RemovePrefix; export {}; //# sourceMappingURL=String.d.ts.map