![]() |
Bearsampp 2026.5.5
|
Static Public Member Functions | |
| static | contains ($string, $search) |
| static | endWith ($string, $search) |
| static | generateSecureBytes ($length=32) |
| static | generateSecureToken ($length=32) |
| static | isAlphanumeric ($string) |
| static | random ($length=32, $withNumeric=true) |
| static | startWith ($string, $search) |
String utility methods and cryptographically secure random generators.
Provides case-insensitive substring checks, prefix/suffix tests, alphanumeric validation, and secure random string/token/bytes generation.
Note: This class is required directly by the bootstrap (class.root.php) because the autoloader itself depends on UtilString\startWith().
Usage:
Definition at line 26 of file class.util.string.php.
|
static |
Checks if a string contains a specified substring (case-insensitive).
| string | $string | The string to search in. |
| string | $search | The substring to search for. |
Definition at line 36 of file class.util.string.php.
Referenced by BinMailpit\checkPort(), BinXlight\checkPort(), BinMariadb\getCmdLineOutput(), BinMysql\getCmdLineOutput(), Util\is32BitsOs(), and Win32Ps\killBins().
|
static |
Checks if a string ends with a specified substring.
| string | $string | The string to check. |
| string | $search | The substring to look for at the end of the string. |
Definition at line 70 of file class.util.string.php.
Referenced by Batch\exec(), Util\findFiles(), BinApache\getAlias(), BinPhp\getExtensionsFromFolder(), LangProc\getList(), TplAppLogs\getMenuLogs(), BinApache\getModulesFromFolder(), Batch\getProcessUsingPort(), and BinApache\getVhosts().
|
static |
Generates a cryptographically secure random bytes string. Useful for encryption keys, initialization vectors, etc.
| int | $length | The length in bytes. |
| Exception | If an appropriate source of randomness cannot be found. |
Definition at line 149 of file class.util.string.php.
References Log\error().
|
static |
Generates a cryptographically secure random token as a hexadecimal string. Ideal for security tokens, session IDs, CSRF tokens, etc.
| int | $length | The length in bytes (output will be double this in hex characters). |
| Exception | If an appropriate source of randomness cannot be found. |
Definition at line 130 of file class.util.string.php.
References Log\error().
|
static |
Checks if a string is alphanumeric.
| string | $string | The string to check. |
Definition at line 85 of file class.util.string.php.
|
static |
Generates a cryptographically secure random string of specified length and character set.
| int | $length | The length of the random string to generate. |
| bool | $withNumeric | Whether to include numeric characters in the random string. |
| Exception | If an appropriate source of randomness cannot be found. |
Definition at line 99 of file class.util.string.php.
References Log\error().
Referenced by OpenSsl\createCrt(), and Batch\getTmpFile().
|
static |
Checks if a string starts with a specified substring.
| string | $string | The string to check. |
| string | $search | The substring to look for at the start of the string. |
Definition at line 53 of file class.util.string.php.
Referenced by BinApache\checkPort(), BinMariadb\checkPort(), BinMysql\checkPort(), Util\findFiles(), BinApache\getModulesFromConf(), BinApache\getModulesFromFolder(), BinApache\getOfflineContent(), BinApache\getOnlineContent(), Batch\getOsInfo(), Batch\getPearVersion(), Batch\getProcessUsingPort(), BinApache\getVhostsUrl(), Win32Ps\killBins(), and Autoloader\resolveClassPath().