Package org.mariuszgromada.math.mxparser
Class StringUtils
- java.lang.Object
-
- org.mariuszgromada.math.mxparser.StringUtils
-
public final class StringUtils extends Object
A class containing all string utils.
-
-
Constructor Summary
Constructors Constructor Description StringUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intcountLines(String text)static intcountOccurrences(String str, String toFind)static StringhexString2AsciiString(String hexString)Converts hex string into ASCII string, where each letter is represented by two hex digits (byte) from the hex string.static StringnumberToAsciiString(double number)Converts (long)double number into ASCII string, where each letter is represented by two hex digits (byte) from the hex representation of the original number cast to long type.static StringnumberToAsciiString(int number)Converts number into ASCII string, where each letter is represented by two hex digits (byte) from the hex representation of the original numberstatic StringnumberToAsciiString(long number)Converts number into ASCII string, where each letter is represented by two hex digits (byte) from the hex representation of the original numberstatic StringnumberToHexString(double number)Converts (long)double number to hex string (plain text)static StringnumberToHexString(int number)Converts integer number to hex string (plain text)static StringnumberToHexString(long number)Converts long number to hex string (plain text)static booleanregexMatch(String str, String pattern)Function used to introduce some compatibility between JAVA and C# while regexp matching.
-
-
-
Method Detail
-
regexMatch
public static boolean regexMatch(String str, String pattern)
Function used to introduce some compatibility between JAVA and C# while regexp matching.- Parameters:
str- Stringpattern- Pattern (regexp)- Returns:
- True if pattern matches entirely, False otherwise
-
numberToHexString
public static String numberToHexString(int number)
Converts integer number to hex string (plain text)- Parameters:
number- Integer number- Returns:
- Hex string (i.e. FF23)
-
numberToHexString
public static String numberToHexString(long number)
Converts long number to hex string (plain text)- Parameters:
number- Long number- Returns:
- Hex string (i.e. FF23)
-
numberToHexString
public static String numberToHexString(double number)
Converts (long)double number to hex string (plain text)- Parameters:
number- Double number- Returns:
- Hex string (i.e. FF23)
-
hexString2AsciiString
public static String hexString2AsciiString(String hexString)
Converts hex string into ASCII string, where each letter is represented by two hex digits (byte) from the hex string.- Parameters:
hexString- Hex string (i.e. 48656C6C6F)- Returns:
- ASCII string (i.e. '48656C6C6F' = 'Hello')
-
numberToAsciiString
public static String numberToAsciiString(int number)
Converts number into ASCII string, where each letter is represented by two hex digits (byte) from the hex representation of the original number- Parameters:
number- Integer number (i.e. 310939249775 = '48656C6C6F')- Returns:
- ASCII string (i.e. '48656C6C6F' = 'Hello')
-
numberToAsciiString
public static String numberToAsciiString(long number)
Converts number into ASCII string, where each letter is represented by two hex digits (byte) from the hex representation of the original number- Parameters:
number- Long number (i.e. 310939249775 = '48656C6C6F')- Returns:
- ASCII string (i.e. '48656C6C6F' = 'Hello')
-
numberToAsciiString
public static String numberToAsciiString(double number)
Converts (long)double number into ASCII string, where each letter is represented by two hex digits (byte) from the hex representation of the original number cast to long type.- Parameters:
number- Double number (i.e. 310939249775 = '48656C6C6F')- Returns:
- ASCII string (i.e. '48656C6C6F' = 'Hello')
-
countLines
public static int countLines(String text)
-
-