[英]Regex doubt in Android (Java) code
Can someone tell me exactly what is this regex doing? 有人能告诉我这个正则表达式到底在做什么吗?
new StringTokenizer(string,":/.@\\;,+ ");
I could not understand the exact meaning of this Regex, though it looks like something to do with splitting a string based on special characters? 我无法理解这个正则表达式的确切含义,虽然它看起来像是根据特殊字符拆分字符串?
StringTokenizer
does not use regular expressions. StringTokenizer
不使用正则表达式。 The second parameter is a list of characters to be used as separators between tokens. 第二个参数是要用作标记之间的分隔符的字符列表。
The JavaDoc says: JavaDoc说:
StringTokenizer
is a legacy class that is retained for compatibility reasons although its use is discouraged in new code.StringTokenizer
是一个遗留类,出于兼容性原因而保留,尽管在新代码中不鼓励使用它。 It is recommended that anyone seeking this functionality use thesplit
method ofString
or thejava.util.regex
package instead.建议任何寻求此功能的人都使用
String
的split
方法或java.util.regex
包。
StringTokenizer
does not use regular expressions. StringTokenizer
不使用正则表达式。 The second argument is just the list of delimiters that it will use by default to split apart the string. 第二个参数只是默认情况下用于拆分字符串的分隔符列表。
There is no regex in this code. 这段代码中没有正则表达式。 the second argument is contains the list of the delimiters used to tokenize the string.
第二个参数包含用于标记字符串的分隔符列表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.