<How can I check whether a given string contains a...
# stackoverflow
u
How can I check whether a given string contains another substring? How can I check whether a given string contains another substring? fun isFieldRepeated(jsonIn: String, field:String): Boolean { var count: Int = 0; while (jsonIn.indexOf(field) > -1) { jsonIn = jsonIn.substring(jsonIn.indexOf(field)+field.length(),jsonIn.length()); count++; } if(count>1) return true; return false; }