如何在JSP或JAVA中拆分字符串?

时间:2015-11-19 10:34:03

标签: java string jsp split

{ “UID”: “049237d2544280”

我有这个字符串。我只想要一个变量中的049237d2544280值。我只想要双引号的值。

我在jsp中使用此代码

List<String> output = new ArrayList<String>();
           Matcher match = Pattern.compile("[0-9]+|[a-z]+|[A-Z]+").matcher(TagID);
          while (match.find()) 
           {

              output.add(match.group());
           }

          out.println(output);

但是输出就像这样  [U,id,049237,d,2544280]

1 个答案:

答案 0 :(得分:1)

试试这个

匹配器匹配= Pattern.compile(&#34; [0-9a-z0-9] {14} +&#34;)。匹配器(TagID);