Java, return if trimmed String in List contains String

后端 未结 7 2356
旧巷少年郎
旧巷少年郎 2020-12-04 17:52

In Java, I want to check whether a String exists in a List myList.

Something like this:

if(myList.contains(\"A\")){
    //         


        
7条回答
  •  天命终不由人
    2020-12-04 18:11

    You may be able to use an approximate string matching library to do this, e.g. SecondString, but that is almost certainly overkill - just use one of the for-loop answers provided instead.

提交回复
热议问题