How to split string at comma but keep white spaces?

后端 未结 1 1827
借酒劲吻你
借酒劲吻你 2021-01-28 06:29

How to split string at comma so that it keeps all spaces. Example:

Input: [\"  hello  , world  \"]

Need to separate this in array so that it lo

1条回答
  •  囚心锁ツ
    2021-01-28 06:58

        String s = " hello , world ";
        String s1[] = s.split(",");
        System.out.println(s1[0]+s1[1]);
    
       output:  hello  world 
    

    0 讨论(0)
提交回复
热议问题