可以,在java里用StringTokenizer
Example:
String[] result = "this is a test".split("\\s");
     for (int x=0; x<result.length; x++)
         System.out.println(result[x]);prints the following output: 
     this
     is
     a
     test

解决方案 »

  1.   

    StringTokenizer st = new StringTokenizer("this is a test");
         while (st.hasMoreTokens()) {
             System.out.println(st.nextToken());
         }
     
    prints the following output:      this
         is
         a
         test
      

  2.   

    可以
    直接用s.trim().split(" ");就可以
    建议分割前先trim,防止字符串两边的空格导致分割错误~~~
      

  3.   

    问问题太要技巧了,同样是一个问题我用另外一种方式问就没人理.(参见http://community.csdn.net/Expert/topic/3906/3906499.xml?temp=.8700983)换了一个方式,有这么多兄弟来帮忙.谢谢了,谢谢大家.
      

  4.   

    String time="2005-04-02 17:56:35.0"如果是上面这个字符串好像不行啊.
      

  5.   

    String time="2005-04-02 17:56:35.0";
    String tmp=time.subString(0,10);
    我用下面的代码它总是报如下的错误org.apache.jasper.JasperException: Unable to compile class for JSPAn error occurred at line: 20 in the jsp file: /jsp/time_split.jsp
    Generated servlet error:
    D:\Example\site\work\org\apache\jsp\jsp\time_005fsplit_jsp.java:82: cannot resolve symbol
    symbol  : method subString (int,int)
    location: class java.lang.String
    String tmp=time.subString(0,10);