Class Utility

java.lang.Object
dev.yasint.regexsynth.core.Utility

public final class Utility
extends java.lang.Object
  • Constructor Summary

    Constructors 
    Constructor Description
    Utility()  
  • Method Summary

    Modifier and Type Method Description
    static java.lang.String asRegexGroupName​(java.lang.String name)
    This method checks whether a string qualifies to be a regex named capture group.
    static java.lang.String asRegexLiteral​(java.lang.String someString)
    Escapes all the special regex constructs.
    static int toCodepoint​(java.lang.String character)
    Converts a given character to its codepoint value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • asRegexLiteral

      public static java.lang.String asRegexLiteral​(java.lang.String someString)
      Escapes all the special regex constructs. VALID_GROUP_NAME i.e. https:// will transform to https:\/\/
      Parameters:
      someString - string to escape
      Returns:
      escaped strings
    • asRegexGroupName

      public static java.lang.String asRegexGroupName​(java.lang.String name)
      This method checks whether a string qualifies to be a regex named capture group. It's same as source code variable declarations.
      Parameters:
      name - capture group name
      Returns:
      the same string if it's valid
    • toCodepoint

      public static int toCodepoint​(java.lang.String character)
      Converts a given character to its codepoint value. If the the character is an empty string the min value (NULL) will be returned.
      Parameters:
      character - as a string (supplementary/bmp) char
      Returns:
      codepoint or NULL