Home > DeveloperSection > Forums > Remove space from string
Vikas Giri
Vikas Giri

Total Post:13

Points:91
Posted on    February-02-2011 2:20 AM

 JavaScript JavaScript 
Ratings:


 1 Reply(s)
 1231  View(s)
Rate this:
how use trim method in javascript
give the sample of its?


Amit Singh

Total Post:103

Points:721
Posted on    February-07-2011 9:24 AM

hi vikas,
in javascript, not using the trim method.
but we replace the start and end space of any give string by javascript as given sample
 

<script language="JavaScript" type="text/javascript">

    functionff() {

    var str="  check thetrim condition here      ";

        str=str.replace(/^\s+|\s+$/g,"");

        alert(str);

    }

</script>





Don't want to miss updates? Please click the below button!

Follow MindStick