typescriptkit
Version:
Basic functionality for TypeScript projects
85 lines (84 loc) • 2.93 kB
TypeScript
/**
* Helper Utility for the String class
*/
export declare class StringExtensions {
/**
* Check whether a function is null or empty
* @param stringObject The string to check.
*/
static isNullOrEmpty(stringObject: string): boolean;
/**
* Check whether a function is null or consists of whitespace
* @param stringObject The string to check.
*/
static isNullOrWhitespace(stringObject: string): boolean;
/**
* Check whether a string starts with a certain character
* @param stringObject The string to check.
* @param characters The characters to check.
*/
static startsWith(stringObject: string, characters: string): boolean;
/**
* Check whether a string ends with a certain character
* @param stringObject The string to check.
* @param characters The characters to check.
*/
static endsWith(stringObject: string, characters: string): boolean;
/**
* Trim the given character at the start of the string
* @param stringObject The string to trim.
* @param characters (optional) The characters to trim.
*/
static trimStartCharacters(stringObject: string, characters?: string): string;
/**
* Trim the given character at the end of the string
* @param stringObject The string to trim.
* @param characters (optional) The characters to trim.
*/
static trimEndCharacters(stringObject: string, characters?: string): string;
/**
* Trim the given character at the start and end of the string
* @param stringObject The string to trim.
* @param characters (optional) The characters to trim.
*/
static trimCharacters(stringObject: string, characters?: string): string;
}
/**
* Interface to allow extension code completion
*/
export interface String {
/**
* Check whether a function is null or empty
*/
isNullOrEmpty(): boolean;
/**
* Check whether a function is null or consists of whitespace
*/
isNullOrWhitespace(): boolean;
/**
* Check whether a string starts with a certain character
* @param startChar The character to check.
*/
startsWith(startChar: string): boolean;
/**
* Check whether a string ends with a certain character
* @param character The character to check.
*/
endsWith(character: string): boolean;
/**
* Trim the given character at the start of the string
* @param character The character to trim.
*/
trimStartCharacters(character: string): string;
/**
* Trim the given character at the end of the string
* @param character The character to trim.
*/
trimEndCharacters(character: string): string;
/**
* Trim the given character at the start and end of the string
* @param character The character to trim.
*/
trimCharacters(character: string): string;
}
export default StringExtensions;