Posted By

adrianparr on 05/14/10


Tagged

strip space remove join split as3 spaces


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

bobby
tspitzr
codyo


AS3 Strip Spaces from a String


 / Published in: ActionScript 3
 

  1. function stripSpaces($myString:String):String
  2. {
  3. return $myString.split(" ").join("");
  4. }
  5.  
  6.  
  7. var originalStr:String = " A B C D E F G ";
  8. trace("originalStr: "+originalStr);
  9. var withNoSpacesStr:String = stripSpaces(originalStr);
  10. trace("withNoSpacesStr: "+withNoSpacesStr);
  11.  
  12. // OUTPUT
  13. // originalStr: A B C D E F G
  14. // withNoSpacesStr: ABCDEFG

Report this snippet  

You need to login to post a comment.