Meta information methods

  1. length
  2. isEmpty
  3. isLowerCase
  4. isUpperCase
  5. isAscii
  6. chars
  7. codePoints

length

Returns the length of the string.

signature

public function length(): int;

usage

echo $str->length(); //> 10

isEmpty

Checks if the current string is empty.

signature

public function isEmpty(): bool;

usage

if($str->isEmpty()){
    //...
}

isLowerCase

Checks if the current string is in lower case.

signature

public function isLowerCase(): bool;

usage

if($str->isLowerCase()){
    //...
}

isUpperCase

Checks if the current string is in upper case.

signature

public function isUpperCase(): bool;

usage

if($str->isUpperCase()){
    //...
}

isAscii

Checks if the current string contains only ASCII characters.

signature

public function isAscii(): bool;

usage

if($str->isAscii()){
    //...
}

chars

Returns an array of chars.

signature

/**
 * @return string[]
 */
public function chars(): array;

codePoints

Returns an array of code points.

signature

/**
 * @return int[]
 */
public function codePoints(): array;