Find a complete word in a string java

前端 未结 9 2054
伪装坚强ぢ
伪装坚强ぢ 2021-01-16 06:52

I am writing a piece of code in which i have to find only complete words for example if i have

String str = \"today is tuesday\";

and I\'m

9条回答
  •  悲&欢浪女
    2021-01-16 07:15

    String[] tokens = str.split(" ");
    
    for(String s: tokens) {
        if ("t".equals(s)) {
            // t exists
            break;
        }
    }
    

提交回复
热议问题