Class StringUtils

java.lang.Object
org.mariuszgromada.math.mxparser.StringUtils

public final class StringUtils extends Object
A class containing all string utils.
Version:
6.1.0
Author:
Mariusz Gromada
MathParser.org - mXparser project page
mXparser on GitHub
INFIMA place to purchase a commercial MathParser.org-mXparser software license
info@mathparser.org
ScalarMath.org - a powerful math engine and math scripting language
Scalar Lite
Scalar Pro
MathSpace.pl
  • Constructor Details

    • StringUtils

      public StringUtils()
  • Method Details

    • regexMatch

      public static boolean regexMatch(String str, String pattern)
      Function used to introduce some compatibility between JAVA and C# while regexp matching.
      Parameters:
      str - String
      pattern - 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')
    • countOccurrences

      public static int countOccurrences(String str, String toFind)
    • countLines

      public static int countLines(String text)