Home Identifier Source Repository
import {$StringUtil} from 'angie/src/util/Util.js'
public class | since 0.3.1 | source

$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

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

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

toFormat(str: string, del: string): string

Util helper to perform toDash or toUnderscore style string

since 0.2.4
public static

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:

NameTypeAttributeDescription
str string

[param=''] String to process

Return:

string

The str param with stripped leading slashes

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:

NameTypeAttributeDescription
str string

[param=''] String to process

Return:

string

The str param with stripped trailing and leading slashes

Example:

'test' === $StringUtil.removeTrailingLeadingSlashes('/test/'); // true

public static removeTrailingSlashes(str: string): string since 0.2.3 source

Util helper to replace trailing slashes

Params:

NameTypeAttributeDescription
str string

[param=''] String to process

Return:

string

The str param with stripped trailing slashes

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:

NameTypeAttributeDescription
str string

String to process

Return:

string

The str param converted to camelCase

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:

NameTypeAttributeDescription
str string

String to process

Return:

string

The str param converted to dash-separation

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

Params:

NameTypeAttributeDescription
str string

String to process

del string

Character with which to replace camelCase capitals

Return:

string

The str param converted to del separation

Example:

$StringUtil.toFormat('testTest', '-'); // = 'test-test'
$StringUtil.toFormat('testTest', '_'); // = 'test_test'

public static toUnderscore(str: string): string since 0.2.4 source

Util helper to replace camelCase with underscore_separation

Params:

NameTypeAttributeDescription
str string

String to process

Return:

string

The str param converted to underscore_separation

Example:

$StringUtil.toCamel('testTest'); // = 'test_test'