$StringUtil
Util is a silent utility class which is not available via any provider on the app object. The only way to access the methods on this class is to import the module. It holds methods quintessential to string manipulation.
Static Method Summary
Static Public Methods | ||
public static |
removeLeadingSlashes(str: string): string Util helper to replace leading slashes |
since 0.2.3 |
public static |
Util helper to replace leading and trailing slashes |
since 0.2.3 |
public static |
removeTrailingSlashes(str: string): string Util helper to replace trailing slashes |
since 0.2.3 |
public static |
Util helper to replace dash/slash separation with camelCase |
since 0.2.4 |
public static |
Util helper to replace camelCase with dash-separation |
since 0.2.4 |
public static |
Util helper to perform |
since 0.2.4 |
public static |
toUnderscore(str: string): string Util helper to replace camelCase with underscore_separation |
since 0.2.4 |
Static Public Methods
public static removeLeadingSlashes(str: string): string since 0.2.3 source
Util helper to replace leading slashes
Params:
Name | Type | Attribute | Description |
str | string | [param=''] String to process |
Example:
'test' === $StringUtil.removeTrailingLeadingSlashes('/test'); // true
public static removeTrailingLeadingSlashes(str: string): string since 0.2.3 source
Util helper to replace leading and trailing slashes
Params:
Name | Type | Attribute | Description |
str | string | [param=''] String to process |
Example:
'test' === $StringUtil.removeTrailingLeadingSlashes('/test/'); // true
public static removeTrailingSlashes(str: string): string since 0.2.3 source
Util helper to replace trailing slashes
Params:
Name | Type | Attribute | Description |
str | string | [param=''] String to process |
Example:
'test' === $StringUtil.removeTrailingLeadingSlashes('test/'); // true
public static toCamel(str: string): string since 0.2.4 source
Util helper to replace dash/slash separation with camelCase
Params:
Name | Type | Attribute | Description |
str | string | String to process |
Example:
$StringUtil.toCamel('test-test'); // = 'testTest'
public static toDash(str: string): string since 0.2.4 source
Util helper to replace camelCase with dash-separation
Params:
Name | Type | Attribute | Description |
str | string | String to process |
Example:
$StringUtil.toDash('testTest'); // = 'test-test'
public static toFormat(str: string, del: string): string since 0.2.4 source
Util helper to perform toDash
or toUnderscore
style string
serilaization
Example:
$StringUtil.toFormat('testTest', '-'); // = 'test-test'
$StringUtil.toFormat('testTest', '_'); // = 'test_test'