String line="word,1.2;3.1!4.5";
What regex should I use in Split(...)
to remove all special characters except dot? (I need the dot to keep double and float values)
You may try this,
string.split("[^.\\w]");
or
string.split("[^.a-zA-Z\\d]");
Add +
after the character class, if you want to apply split on one or more characters.
试试这个代码
line.split("[.\w]");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.