Class StringUtils

java.lang.Object
at.gv.egovernment.moaspss.util.StringUtils

public class StringUtils extends Object
Utitility functions for string manipulations.
  • Constructor Details

    • StringUtils

      public StringUtils()
  • Method Details

    • removeBlanks

      public static String removeBlanks(String s)
      Removes all blanks and tabs from the given string.
      Parameters:
      s - The string to remove all blanks and tabs from.
      Returns:
      The input string with all blanks and tabs removed from.
    • removeToken

      public static String removeToken(String s, String token)
      Removes all occurences of the specified token from the the given string.
      Parameters:
      s - The string to remove all occurences of the specified token from.
      Returns:
      The input string with all occurences of the specified token removed from.
    • deleteLeadingZeros

      public static String deleteLeadingZeros(String s)
      Removes all leading zeros from the input string.
      Parameters:
      s - The string remove the leading zeros from.
      Returns:
      The input string with the leading zeros removed from.
    • replaceAll

      public static String replaceAll(String s, String search, String replace)
      Replaces each substring of string s that matches the given search string by the given replace string.
      Parameters:
      s - The string where the replacement should take place.
      search - The pattern that should be replaced.
      replace - The string that should replace all each search string within s.
      Returns:
      A string where all occurrence of search are replaced with replace.
    • changeSLVersion

      public static String changeSLVersion(String s, String slPrefixOld, String slPrefixNew, String slNSUriOld, String slNSUriNew)
      Changes the SecurityLayer version in the given string. This method usually takes as input an XML structure represented in a string format and changes the SecurityLayer namespaces prefixes and URIs from one SecurityLayer version to another. e.g.: code>sl10 to sl and http://www.buergerkarte.at/namespaces/securitylayer/20020225# to http://www.buergerkarte.at/namespaces/securitylayer/1.2#
      Parameters:
      s - The string (usally an XML structure) where the SecurityLayer version should be changed.
      slPrefixOld - The SecurityLayer namespace prefix that should be replaced by the new one.
      slPrefixNew - The new SecurityLayer namespace prefix that should replace the old one.
      slNSUriOld - The SecurityLayer namespace URI that should be replaced by the new one.
      slNSUriNew - The new SecurityLayer namespace URI that should replace the old one.
      Returns:
      A string where the SecurityLayer namespace prefixes and URIs are replaced by new ones.
    • removeXMLDeclaration

      public static String removeXMLDeclaration(String xmlString)
      Removes the XML declaration from an XML expression.
      Parameters:
      xmlString - XML expression as String
      Returns:
      XML expression, XML declaration removed
    • isEmpty

      public static boolean isEmpty(String s)
      Checks if String is empty
      Parameters:
      s - String to be checked if empty
      Returns:
      True if String is empty, false otherwise