18.207.255.49 |    

Navigation

Google Advertisement

Die Funktion ltrim() ist der gleichnamigen PHP Funktion nach empfunden. Sie entfernt Whitespaces am Anfang eines Strings. Die Funktion kann den String als Parameter $1 aber auch durch STDIN entgegen nehmen.

ltrim
  1. # ***************************************************************************
  2. # This function removes whitespace at the beginning of a string.
  3. #
  4. #  @param string $1 string (optional, can also handle STDIN)
  5. #  @return string
  6. #  @example:    echo " That is a sentinece " | trim
  7.  
  8. function ltrim() {
  9.  
  10. if [ -n "$1" ]; then
  11.         echo $1 | sed 's/^[[:space:]]*//g'
  12. else
  13.         cat - | sed 's/^[[:space:]]*//g'
  14. fi
  15.  
  16. }
Parsed in 0.004 seconds at 119.08 KB/s

Search
 
Full text search by name and content of a snippet.

User online
There are 1 users online.

Tags Cloud

Latest snippets
last day of last month
(Bash::Snippets)
crypt_apr1_md5
(PHP::Function)
crypt_apr1_md5
(Perl::Function)
transparent
(CSS)
rfc2822Toiso8601
(PHP::Function)
STDERR
(Bash::Function)
radius
(CSS)
shadow
(CSS)
rotate
(CSS)
create_function
(JavaScript::Snippets)