class StringNormalise (View source)

Windwalker Framework String Normalise Class

This class is based on Joomla String package

Methods

static string
fromCamelCase(string $input, boolean $grouped = false)

Method to convert a string from camel case.

static string
toCamelCase(string $input)

Method to convert a string into camel case.

static string
toDashSeparated(string $input)

Method to convert a string into dash separated form.

static string
toSpaceSeparated(string $input)

Method to convert a string into space separated form.

static string
toDotSeparated(string $input)

Method to convert a string into dot separated form.

static string
separate(string $input, string $separator = '_')

Separate a string by custom separator.

static string
toUnderscoreSeparated(string $input)

Method to convert a string into underscore separated form.

static string
toVariable(string $input)

Method to convert a string into variable form.

static string
toKey(string $input)

Method to convert a string into key form.

static string
toClassNamespace(string $class)

Convert to standard PSR-0/PSR-4 class name.

Details

at line line 42
static string fromCamelCase(string $input, boolean $grouped = false)

Method to convert a string from camel case.

This method offers two modes. Grouped allows for splitting on groups of uppercase characters as follows:

"FooBarABCDef" becomes array("Foo", "Bar", "ABC", "Def") "JFooBar" becomes array("J", "Foo", "Bar") "J001FooBar002" becomes array("J001", "Foo", "Bar002") "abcDef" becomes array("abc", "Def") "abcdefGhiJkl" becomes array("abcdef", "GhiJkl") "ThisIsANASAAstronaut" becomes array("This", "Is", "ANASA", "Astronaut")) "JohnFitzgeraldKennedy" becomes array("John", "FitzgeraldKennedy"))

Non-grouped will split strings at each uppercase character.

Parameters

string $input The string input (ASCII only).
boolean $grouped Optionally allows splitting on groups of uppercase characters.

Return Value

string The space separated string.

at line line 58
static string toCamelCase(string $input)

Method to convert a string into camel case.

Parameters

string $input The string input (ASCII only).

Return Value

string The camel case string.

at line line 77
static string toDashSeparated(string $input)

Method to convert a string into dash separated form.

Parameters

string $input The string input (ASCII only).

Return Value

string The dash separated string.

at line line 92
static string toSpaceSeparated(string $input)

Method to convert a string into space separated form.

Parameters

string $input The string input (ASCII only).

Return Value

string The space separated string.

at line line 107
static string toDotSeparated(string $input)

Method to convert a string into dot separated form.

Parameters

string $input The string input (ASCII only).

Return Value

string The dot separated string.

at line line 123
static string separate(string $input, string $separator = '_')

Separate a string by custom separator.

Parameters

string $input The string input (ASCII only).
string $separator The separator to want to separate it.

Return Value

string The string be converted.

at line line 137
static string toUnderscoreSeparated(string $input)

Method to convert a string into underscore separated form.

Parameters

string $input The string input (ASCII only).

Return Value

string The underscore separated string.

at line line 152
static string toVariable(string $input)

Method to convert a string into variable form.

Parameters

string $input The string input (ASCII only).

Return Value

string The variable string.

at line line 180
static string toKey(string $input)

Method to convert a string into key form.

Parameters

string $input The string input (ASCII only).

Return Value

string The key string.

at line line 198
static string toClassNamespace(string $class)

Convert to standard PSR-0/PSR-4 class name.

Parameters

string $class The class name string.

Return Value

string Normalised class name.