Skip to content

Instantly share code, notes, and snippets.

@baobao
Created May 21, 2013 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baobao/5619683 to your computer and use it in GitHub Desktop.
Save baobao/5619683 to your computer and use it in GitHub Desktop.
前後の空白を削除する(半角スペースおよび、全角スペース)
var str:String = "      hoge    hoge   ";
var reg:RegExp = /^[  ]+|[  ]+$/g;
var result:String = str.replace(reg, "");
trace("|" + result + "|"); //ourpur::hoge    hoge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment