Namespaces

  • Nette
    • Application
    • Caching
    • Collections
    • Config
    • Forms
    • IO
    • Loaders
    • Mail
    • Reflection
    • Security
    • Templates
    • Web
  • None
  • PHP

Classes

  • ArrayTools
  • Callback
  • Component
  • ComponentContainer
  • Configurator
  • DateTime
  • Debug
  • Environment
  • Framework
  • FreezableObject
  • GenericRecursiveIterator
  • Image
  • ImageMagick
  • InstanceFilterIterator
  • Object
  • ObjectMixin
  • Paginator
  • RecursiveComponentIterator
  • ServiceLocator
  • SmartCachingIterator
  • String
  • Tools

Interfaces

  • IComponent
  • IComponentContainer
  • IDebuggable
  • IServiceLocator
  • ITranslator

Exceptions

  • AmbiguousServiceException
  • Overview
  • Namespace
  • Class
  • Tree
  • Other releases

Class String

String tools library.

Final
Namespace: Nette
Author: David Grudl
Located at Utils/String.php
Methods summary
final public
# __construct( )

Static class - cannot be instantiated.

Static class - cannot be instantiated.

public static boolean
# checkEncoding( string $s, string $encoding = 'UTF-8' )

Checks if the string is valid for the specified encoding.

Checks if the string is valid for the specified encoding.

Parameters

$s
string
byte stream to check
$encoding
string
expected encoding

Returns

boolean
public static string
# fixEncoding( string $s, string $encoding = 'UTF-8' )

Returns correctly encoded string.

Returns correctly encoded string.

Parameters

$s
string
byte stream to fix
$encoding
string
encoding

Returns

string
public static string
# chr( integer $code, string $encoding = 'UTF-8' )

Returns a specific character.

Returns a specific character.

Parameters

$code
integer
codepoint
$encoding
string
encoding

Returns

string
public static boolean
# startsWith( string $haystack, string $needle )

Starts the $haystack string with the prefix $needle?

Starts the $haystack string with the prefix $needle?

Parameters

$haystack
string
$needle
string

Returns

boolean
public static boolean
# endsWith( string $haystack, string $needle )

Ends the $haystack string with the suffix $needle?

Ends the $haystack string with the suffix $needle?

Parameters

$haystack
string
$needle
string

Returns

boolean
public static string
# normalize( string $s )

Removes special controls characters and normalizes line endings and spaces.

Removes special controls characters and normalizes line endings and spaces.

Parameters

$s
string
UTF-8 encoding or 8-bit

Returns

string
public static string
# webalize( string $s, string $charlist = NULL, boolean $lower = TRUE )

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

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

Parameters

$s
string
UTF-8 encoding
$charlist
string
ASCII
$lower
boolean

Returns

string
public static string
# truncate( string $s, integer $maxLen, string $append = "\xE2\x80\xA6" )

Truncates string to maximal length.

Truncates string to maximal length.

Parameters

$s
string
UTF-8 encoding
$maxLen
integer
$append
string
UTF-8 encoding

Returns

string
public static string
# indent( string $s, integer $level = 1, string $chars = "\t" )

Indents the content from the left.

Indents the content from the left.

Parameters

$s
string
UTF-8 encoding or 8-bit
$level
integer
$chars
string

Returns

string
public static string
# lower( string $s )

Convert to lower case.

Convert to lower case.

Parameters

$s
string
UTF-8 encoding

Returns

string
public static string
# upper( string $s )

Convert to upper case.

Convert to upper case.

Parameters

$s
string
UTF-8 encoding

Returns

string
public static string
# capitalize( string $s )

Capitalize string.

Capitalize string.

Parameters

$s
string
UTF-8 encoding

Returns

string
public static string
# trim( string $s, string $charlist = " \t\n\r\0\x0B\xC2\xA0" )

Strips whitespace.

Strips whitespace.

Parameters

$s
string
UTF-8 encoding
$charlist
string

Returns

string
public static string
# padLeft( string $s, integer $length, string $pad = ' ' )

Pad a string to a certain length with another string.

Pad a string to a certain length with another string.

Parameters

$s
string
UTF-8 encoding
$length
integer
$pad
string

Returns

string
public static string
# padRight( string $s, integer $length, string $pad = ' ' )

Pad a string to a certain length with another string.

Pad a string to a certain length with another string.

Parameters

$s
string
UTF-8 encoding
$length
integer
$pad
string

Returns

string
Nette Framework 0.9.7 API documentation generated by ApiGen 2.3.0