Last active
September 26, 2021 10:06
-
-
Save vigneshrcsengg/9fdf4f294da2126f451d8a38b9449e98 to your computer and use it in GitHub Desktop.
String Utilities
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StringUtil { | |
public static void main(String args[]) { | |
} | |
public static boolean isOnlyOneWord(String s) { | |
return (s.length() > 0 && s.split("\\s+").length == 1); | |
} | |
public static boolean isStringContainNumeric(String str) { | |
return str.matches(".*\\d.*"); | |
} | |
public static boolean isMatch(String text, String pattern) { | |
return text.matches(pattern.replace("?", ".?").replace("*", ".*?")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment