Package at.gv.egovernment.moaspss.util
Class StringUtils
java.lang.Object
at.gv.egovernment.moaspss.util.StringUtils
Utitility functions for string manipulations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringchangeSLVersion(String s, String slPrefixOld, String slPrefixNew, String slNSUriOld, String slNSUriNew) Changes the SecurityLayer version in the given string.static StringRemoves all leading zeros from the input string.static booleanChecks if String is emptystatic StringRemoves all blanks and tabs from the given string.static StringremoveToken(String s, String token) Removes all occurences of the specified token from the the given string.static StringremoveXMLDeclaration(String xmlString) Removes the XML declaration from an XML expression.static StringreplaceAll(String s, String search, String replace) Replaces each substring of stringsthat matches the givensearchstring by the givenreplacestring.
-
Constructor Details
-
StringUtils
public StringUtils()
-
-
Method Details
-
removeBlanks
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
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
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
Replaces each substring of stringsthat matches the givensearchstring by the givenreplacestring.- Parameters:
s- The string where the replacement should take place.search- The pattern that should be replaced.replace- The string that should replace all eachsearchstring withins.- Returns:
- A string where all occurrence of
searchare replaced withreplace.
-
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 toslandhttp://www.buergerkarte.at/namespaces/securitylayer/20020225#tohttp://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
Removes the XML declaration from an XML expression.- Parameters:
xmlString- XML expression as String- Returns:
- XML expression, XML declaration removed
-
isEmpty
Checks if String is empty- Parameters:
s- String to be checked if empty- Returns:
- True if String is empty, false otherwise
-