Strip Whitespace with RegExp in AS3


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // pvalue has whitespace
  2. var whitespace:RegExp = /(\t|\n|\s{2,})/g;
  3. var trimmedValue:String = pValue.replace(whitespace, "");
  4. trace(pValue, trimmedValue);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.