Class String (namespace Nette)


String tools library.


Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Located: in /String.php (line 32)
Constructor Summary
public
Static class - cannot be instantiated.
Method Summary
static void
bytes ($bytes)
static string
capitalize (string $s)
Capitalize string.
static bool
checkEncoding (string $s, [string $encoding = 'UTF-8'])
Checks if the string is valid for the specified encoding.
static bool
endsWith (string $haystack, string $needle)
Ends the $haystack string with the suffix $needle?
static string
fixEncoding (string $s, [string $encoding = 'UTF-8'])
Returns correctly encoded string.
static string
lower (string $s)
Convert to lower case.
static string
normalize (string $s)
Removes special controls characters and normalizes line endings and spaces.
static bool
startsWith (string $haystack, string $needle)
Starts the $haystack string with the prefix $needle?
static string
truncate (string $s, int $maxLen, [string $append = "\xE2\x80\xA6"])
Truncates string to maximal length.
static string
upper (string $s)
Convert to upper case.
static string
webalize (string $s, [string $charlist = NULL])
Converts to web safe characters [a-z0-9-] text.

Constructor Details

line 38

__construct

public __construct ()

Static class - cannot be instantiated.

Method Details

line 213

bytes

public static void bytes ($bytes)

Input
$bytes
Output
void  
Tags
Deprecated

line 203

capitalize

public static string capitalize (string $s)

Capitalize string.

Input
string $s
Output
string  

line 51

checkEncoding

public static bool checkEncoding (string $s, [string $encoding = 'UTF-8'])

Checks if the string is valid for the specified encoding.

Input
string $s byte stream to check
string $encoding expected encoding
Output
bool  

line 90

endsWith

public static bool endsWith (string $haystack, string $needle)

Ends the $haystack string with the suffix $needle?

Input
string $haystack
string $needle
Output
bool  

line 64

fixEncoding

public static string fixEncoding (string $s, [string $encoding = 'UTF-8'])

Returns correctly encoded string.

Input
string $s byte stream to fix
string $encoding encoding
Output
string  

line 179

lower

public static string lower (string $s)

Convert to lower case.

Input
string $s
Output
string  

line 102

normalize

public static string normalize (string $s)

Removes special controls characters and normalizes line endings and spaces.

Input
string $s
Output
string  

line 77

startsWith

public static bool startsWith (string $haystack, string $needle)

Starts the $haystack string with the prefix $needle?

Input
string $haystack
string $needle
Output
bool  

line 155

truncate

public static string truncate (string $s, int $maxLen, [string $append = "\xE2\x80\xA6"])

Truncates string to maximal length.

Input
string $s in UTF-8
int $maxLen
string $append
Output
string  

line 191

upper

public static string upper (string $s)

Convert to upper case.

Input
string $s
Output
string  

line 128

webalize

public static string webalize (string $s, [string $charlist = NULL])

Converts to web safe characters [a-z0-9-] text.

Input
string $s in UTF-8
string $charlist
Output
string