Created
October 30, 2012 03:31
-
-
Save relax-more/3978152 to your computer and use it in GitHub Desktop.
[Java] String文字列の前後から空白・改行文字を取り除く
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String trim(String string) { | |
return string.replaceAll("^[\\s ]*", "").replaceAll("[\\s ]*$", ""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment