Package mgui.util
Class StringFunctions
java.lang.Object
mgui.util.StringFunctions
public class StringFunctions
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description StringFunctions() -
Method Summary
Modifier and Type Method Description static intcountOccurrences(java.lang.String s, java.lang.String occ)Counts the number of timesoccoccurs ins.static booleanisInteger(java.lang.String s)Determines whetherscan be converted to an integerstatic booleanisNumeric(java.lang.String s)Determines whetherscan be converted to a numberstatic java.lang.StringreplaceAll(java.lang.String string, java.lang.String find, java.lang.String replace)Replaces all occurrences offindinstringand replaces them withreplace, without using regex.static java.lang.StringresizeString(java.lang.String string, int length)Resizesstringto lengthlength, by truncating or padding with spaces.static java.lang.StringresizeString(java.lang.String string, int length, char pad)Resizesstringto lengthlength, by truncating or padding.static java.lang.Stringtrim(java.lang.String s)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
StringFunctions
public StringFunctions()
-
-
Method Details
-
trim
public static java.lang.String trim(java.lang.String s) -
countOccurrences
public static int countOccurrences(java.lang.String s, java.lang.String occ)Counts the number of timesoccoccurs ins.- Parameters:
s-occ-- Returns:
-
resizeString
public static java.lang.String resizeString(java.lang.String string, int length)Resizesstringto lengthlength, by truncating or padding with spaces.- Parameters:
string-length-- Returns:
-
resizeString
public static java.lang.String resizeString(java.lang.String string, int length, char pad)Resizesstringto lengthlength, by truncating or padding.- Parameters:
string-length-pad-- Returns:
-
replaceAll
public static java.lang.String replaceAll(java.lang.String string, java.lang.String find, java.lang.String replace)Replaces all occurrences offindinstringand replaces them withreplace, without using regex.- Parameters:
string-find-replace-- Returns:
-
isNumeric
public static boolean isNumeric(java.lang.String s)Determines whetherscan be converted to a number- Parameters:
s-- Returns:
-
isInteger
public static boolean isInteger(java.lang.String s)Determines whetherscan be converted to an integer- Parameters:
s-- Returns:
-