-
-
Save avinashkoyyana/5239459 to your computer and use it in GitHub Desktop.
Set of funcitons that trims a string in Javascipt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Set of funcitons that trims a string in Javascipt :) | |
**/ | |
function trim(stringToTrim) { | |
return stringToTrim.replace(/^\s+|\s+$/g,""); | |
} | |
function ltrim(stringToTrim) { | |
return stringToTrim.replace(/^\s+/,""); | |
} | |
function rtrim(stringToTrim) { | |
return stringToTrim.replace(/\s+$/,""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment