Skip to content

Instantly share code, notes, and snippets.

@kanemu
Created March 12, 2011 11:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kanemu/867201 to your computer and use it in GitHub Desktop.
Save kanemu/867201 to your computer and use it in GitHub Desktop.
[groovy]全角英数を半角英数に変換
String str = 'Hello,1717です。'
str = str.replaceAll(/[\uff01-\uff5e]/){new String((char)(((int)it)-65248))}
assert str=='Hello,1717です。'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment