$string = " Hello World!"; $newString = JString::ltrim($string); echo $newString; // Output: "Hello World!"
$string = "\tOne fish\t Two fish\t Red fish\tBlue fish "; $newString = JString::ltrim($string); echo $newString; // Output: "One fish\t Two fish\t Red fish\tBlue fish "
$string = " This string has no leading whitespace."; $newString = JString::ltrim($string); echo $newString; // Output: "This string has no leading whitespace."In this example, the ltrim() function is used on a string that has no leading whitespace characters. The function does not modify the string, and the output is the same as the input. This function is part of the Joomla String (JString) library.