WonderPush PHP library
  • Namespace
  • Class
Navigation
  • Namespace
  • Class
Namespaces
  • WonderPush
    • Api
    • Errors
    • Net
    • Obj
    • Params
    • Util
Classes
  • ArrayUtil
  • DefaultLogger
  • JsonSerializable
  • StringUtil
  • TimeUnit
  • TimeUtil
  • TimeValue
  • UrlUtil
Interfaces
  • Logger

Class StringUtil

Utility class for string manipulation.

Namespace: WonderPush\Util
Located at Util/StringUtil.php

Methods summary

public static beginsWith( string $subject, string $prefix ) : boolean

Returns whether a given string is prefixed by another.

Returns whether a given string is prefixed by another.

Parameters

$subject
The string to be tested
$prefix
The prefix to be detected

Returns

boolean
public static endsWith( string $subject, string $suffix ) : boolean

Returns whether a given string is suffixed by another.

Returns whether a given string is suffixed by another.

Parameters

$subject
The string to be tested
$suffix
The suffix to be detected

Returns

boolean
public static contains( string $haystack, string $needle ) : boolean

Returns whether a given string contains another.

Returns whether a given string contains another.

Parameters

$haystack
The string to be tested
$needle
The substring to be detected

Returns

boolean
public static format( string $format, string[]|stdClass|mixed... $args ) : string

Performs string replacement of placeholders using the given replacements.

Performs string replacement of placeholders using the given replacements.

If the second argument is an array, occurrences of each {key} in the format string will be replaced. Otherwise, instances of {0}, {1}, etc… in the format string will be replaced by the value of the following arguments.

The following two calls are identical: format("{0}-{1}-{2}", "2001", "12", "31") and format("{0}-{1}-{2}", array("2001", "12", "31")).

Parameters

$format
The format string with {key} occurrences to be replaced.
$args
The values used for replacement. Can also be multiple separate parameters.

Returns

string
WonderPush PHP library API documentation generated by ApiGen