Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products. If you have feedback or questions as you navigate the site, click Send Feedback.

As PHP version 5.5 is no longer supported by the community, we strongly recommend new apps use the PHP 7+ runtime.

\google\appengine\util\StringUtil

Stay organized with collections Save and categorize content based on your preferences.

FINAL

Various PHP string related utility functions.

Methods

endsWith

STATIC   

endsWith(string $input, string $suffix) : boolean

Return true if the first paramater contains the second parameter at the end.

Parameters

Name Description

$input

string

The input string which may contain the suffix.

$suffix

string

The string to look for at the end of the input.

Returns

boolean

true iff the input contains the suffix at the end.

startsWith

STATIC   

startsWith(string $input, string $prefix) : boolean

Return true if the input string starts with the prefix string.

Parameters

Name Description

$input

string

The string which may contain the prefix at the start.

$prefix

string

The string to look for at the start of the input.

Returns

boolean

true iff the input contains the prefix at the start.

base64UrlEncode

STATIC   

base64UrlEncode(string $input) : string

Base64 encode a string, ensuring that the output is safe to use in a URL.

Parameters

Name Description

$input

string

The string which may not be url safe.

Returns

string

A Base64 encoded url safe string.

base64UrlDecode

STATIC   

base64UrlDecode(string $input) : string

Base64 decode a string that was encoded with base64UrlEncode.

Parameters

Name Description

$input

string

The url safe Base64 encoded string.

Returns

string

The original string which may not be url safe.