public static
string
|
#
format( string $value, string $formatType, mixed $format )
Formats a string by the given format type.
Formats a string by the given format type.
Parameters
- $value
- Value
- $formatType
- Format type (any method name of this class)
- $format
- For possible values look at the other methods of this class
Returns
string string
Throws
InvalidArgumentException InvalidArgumentException
|
|
public static
string
|
#
date( string $value, string $format = '' )
Formats a string by date() .
Formats a string by date() .
Parameters
- $value
- Unix timestamp or datetime string for <code>strtotime</code>
- $format
- Default format is <code>d.m.Y</code>
Returns
string string
See
|
|
public static
string
|
#
strftime( string $value, string $format = '' )
Formats a string by strftime() .
Formats a string by strftime() .
Parameters
- $value
- Unix timestamp or datetime string for <code>strtotime</code>
- $format
- Possible values are format strings like in <code>strftime</code> or "date" or
"datetime", default is "date"
Returns
string string
See
|
|
public static
string
|
#
number( string $value, array $format = [] )
Formats a string by number_format() .
Formats a string by number_format() .
Parameters
- $value
- Value
- $format
- Array with number of decimals, decimals point and thousands separator, default
is <code>array(2, ',', ' ')</code>
Returns
string string
See
|
|
public static
string
|
#
bytes( string $value, array $format = [] )
Formats a string as bytes.
Formats a string as bytes.
Parameters
- $value
- Value
- $format
- Same as <code><a href="class-rex_formatter.html#_number">rex_formatter::number()</a></code>
Returns
string string
|
|
public static
string
|
#
sprintf( string $value, string $format = '' )
Formats a string by sprintf() .
Formats a string by sprintf() .
Parameters
Returns
string string
See
|
|
public static
string
|
#
nl2br( string $value )
Formats a string by nl2br .
Formats a string by nl2br .
Parameters
Returns
string string
See
|
|
public static
string
|
#
truncate( string $value, array $format = [] )
Truncates a string.
Parameters
- $value
- Value
- $format
- Default format is <code>array('length' => 80, 'etc' => '...',
'break_words' => false)</code>
Returns
string string
|
|
public static
string
|
#
widont( string $value )
Avoid widows in a string.
Avoid widows in a string.
Parameters
Returns
string string
|
|
public static
string
|
#
version( string $value, string $format )
Formats a version string by sprintf() .
Formats a version string by sprintf() .
Parameters
- $value
- Version
- $format
- Version format, e.g. "%s.%s"
Returns
string string
See
|
|
public static
string
|
#
url( string $value, array $format = [] )
Formats a string as link.
Formats a string as link.
Parameters
- $value
- URL
- $format
- Array with link attributes and params
Returns
string Link
|
|
public static
string
|
#
email( string $value, array $format = [] )
Formats a string as email link.
Formats a string as email link.
Parameters
- $value
- Email
- $format
- Array with link attributes and params
Returns
string Email link
|
|
public static
string
|
#
custom( string $value, callable|array $format )
Formats a string by a custom callable.
Formats a string by a custom callable.
Parameters
- $value
- Value
- $format
- A callable or an array of a callable and additional params
Returns
string string
Throws
|
|