/** * String-focused utility helpers. * * @module bquery/core/utils/string */ /** * Capitalizes the first letter of a string. * * @param str - The string to capitalize * @returns The capitalized string * * @example * ```ts * capitalize('hello'); // 'Hello' * ``` */ export declare function capitalize(str: string): string; /** * Converts a string to kebab-case. * * @param str - The string to convert * @returns The kebab-cased string * * @example * ```ts * toKebabCase('myVariableName'); // 'my-variable-name' * ``` */ export declare function toKebabCase(str: string): string; /** * Converts a string to camelCase. * * @param str - The string to convert * @returns The camelCased string * * @example * ```ts * toCamelCase('my-variable-name'); // 'myVariableName' * ``` */ export declare function toCamelCase(str: string): string; /** * Truncates a string to a maximum length. * * @param str - The string to truncate * @param maxLength - The maximum length * @param suffix - The suffix to append when truncating (default: '…') * @returns The truncated string * * @example * ```ts * truncate('Hello world', 8); // 'Hello w…' * ``` */ export declare function truncate(str: string, maxLength: number, suffix?: string): string; /** * Converts a string to a URL-friendly slug. * * @param str - The string to slugify * @returns The slugified string * * @example * ```ts * slugify('Hello, World!'); // 'hello-world' * ``` */ export declare function slugify(str: string): string; /** * Escapes a string for safe usage inside a RegExp. * * @param str - The string to escape * @returns The escaped string * * @example * ```ts * escapeRegExp('[a-z]+'); // '\\[a-z\\]+' * ``` */ export declare function escapeRegExp(str: string): string; /** * Converts a string to `snake_case`. * * @example * ```ts * toSnakeCase('myVariableName'); // 'my_variable_name' * toSnakeCase('MyVariableName'); // 'my_variable_name' * ``` */ export declare function toSnakeCase(str: string): string; /** * Converts a string to `PascalCase`. * * @example * ```ts * toPascalCase('my-variable-name'); // 'MyVariableName' * ``` */ export declare function toPascalCase(str: string): string; /** * Converts a string to `Title Case`. Each whitespace-separated word is * capitalized. * * @example * ```ts * toTitleCase('hello world'); // 'Hello World' * ``` */ export declare function toTitleCase(str: string): string; /** * Pads a string symmetrically to the given length with `char` (default * space). Returns the original string if it is already at or above the * target length. */ export declare function pad(str: string, length: number, char?: string): string; /** * Pads the start of the string to the given length with `char` (default * space). Convenience wrapper around `String.prototype.padStart` to keep * a consistent string-utility namespace. */ export declare function padStart(str: string, length: number, char?: string): string; /** * Pads the end of the string to the given length with `char` (default * space). Convenience wrapper around `String.prototype.padEnd`. */ export declare function padEnd(str: string, length: number, char?: string): string; /** * Counts whitespace-separated words in a string. */ export declare function wordCount(str: string): number; /** * Substitutes `${name}` placeholders with values from `vars`. Does not * evaluate code — substitution is purely string-based, so this is safe to * use with untrusted templates. * * @remarks Variable names are limited to 200 characters per placeholder to * guard against pathological inputs. * * @example * ```ts * template('Hello ${name}!', { name: 'world' }); // 'Hello world!' * ``` */ export declare function template(str: string, vars: Record): string; /** * Strips HTML tags from a string using a DOM-free linear scanner. This is * intentionally **not** a sanitizer for arbitrary untrusted HTML — prefer * `sanitizeHtml()` from `@bquery/bquery/security` for that purpose. Use * `stripHtml()` when you simply need a plaintext snippet (e.g. generating * a meta description from server-side Markdown output). * * The scanner discards the bodies of `` style closers), then * removes any residual tag delimiters. * * @remarks DOM-free; safe to use in SSR. */ export declare function stripHtml(str: string): string; /** * Returns a random string of the given length using the supplied charset. * Uses `crypto.getRandomValues` when available, falling back to * `Math.random()` (which is non-cryptographic). */ export declare function randomString(length: number, charset?: string): string; /** * Splits a string on universal line terminators, preserving empty lines. * * @example * ```ts * lines('a\r\nb\n\nc'); // ['a', 'b', '', 'c'] * ``` */ export declare function lines(str: string): string[]; //# sourceMappingURL=string.d.ts.map