Content slimmers

Default trim chars. Custom chars can be provided where applicable.

  • white space

  • \n new line

  • \r carriage return

  • \t tab

  • \v vertical tab

  • \0 null character

trim(string $chars)

Trim the beginning and end of String.

Str::set('    Good morning  ')->trim(); // "Good morning"

trimLeft(string $chars)

Trim the beginning of String.

Str::set('    Good morning  ')->trim(); // "Good morning  "

trimRight(string $chars)

Trim the end of String.

Str::set('    Good morning  ')->trim(); // "    Good morning"

trimInside()

slice( $start = 0, $length = null )

Last updated