kotlin accept only numbers in string code example Example: kotlin string contains integer str.matches(".*\\d.*");