Class tcUtilStringOperations

java.lang.Object
com.thortech.xl.util.adapters.tcUtilStringOperations

public class tcUtilStringOperations extends Object
This class that has basic string operations utility methods. Author: Solomon Niyazov January 7, 2002.
  • Method Details

    • getRandomString

      public static String getRandomString(int len)
      method that returns a random string of the specified length.
      Parameters:
      len - len.
      Returns:
      String.
    • replaceWithWhitespace

      public static String replaceWithWhitespace(String psInput, char pcOldChar)
      method that replaces the specified character of a string with a whitespace character.
      Parameters:
      psInput - string on which this operation is performed.
      pcOldChar - character to be replaced by the whitespace character.
      Returns:
      string with whitespace character(s) in place of pcOldChar.
    • insertWhiteSpace

      public static String insertWhiteSpace(String psInput, int pnOffset, int pnNumSpaces)
      method that insert whitespace character(s) into the specified string
      Parameters:
      psInput - string on which this operation is performed.
      pnOffset - beginning position of whitespace insertion.
      pnNumSpaces - number of whitespace characters to be inserted
      Returns:
      string with whitespace character(s) inserted.
    • holdData

      public static String holdData(String data)
      method that holds the value passed to it and returns it back This is usefull for entity adapters to map Xellerate data from User management form etc to process data.
      Parameters:
      data - data.
      Returns:
      String data.
    • performConcat

      public static String performConcat(String value1, String value2)
      method that performs concatenation of two strings.
      Parameters:
      value1 - value1.
      value2 - value2.
      Returns:
      String value1+value2.
    • performConcatWithSpace

      public static String performConcatWithSpace(String value1, String value2)
      method that performs concatenation of two strings with a space in between
      Parameters:
      value1 - value1.
      value2 - value2.
      Returns:
      String value1+value2.
    • performSubstringLess

      public static String performSubstringLess(String value, int beginPos, int endPos) throws Exception
      method that performs substring function based on specified begin and end positions. This method accomodates the string has less number of charaters than endPos value.
      Parameters:
      value - String to be checked.
      beginPos - begining Position.
      endPos - end Position.
      Returns:
      String substring
      Throws:
      Exception
    • performSubstring

      public static String performSubstring(String value, int beginPos, int endPos) throws Exception
      method that performs substring function based on specified begin and end positions.
      Parameters:
      value - String to be checked
      beginPos - begining Position.
      endPos - end Position.
      Returns:
      String Substring
      Throws:
      Exception
    • performSubstring

      public static String performSubstring(String value, int beginPos) throws Exception
      method that performs substring function based on specified begin position.
      Parameters:
      value - String to be checked
      beginPos - begining Position.
      Returns:
      String Substring
      Throws:
      Exception
    • performSubstring

      public static String performSubstring(String value, Integer beginPos, Integer endPos) throws Exception
      method that performs substring function based on specified begin and end positions.
      Parameters:
      value - String to be checked
      beginPos - begining Position.
      endPos - end Position.
      Returns:
      String substring
      Throws:
      Exception
    • performSubstringLess

      public static String performSubstringLess(String value, Integer beginPos, Integer endPos) throws Exception
      method that performs substring function based on specified begin and end positions. This method accomodates the string has less number of charaters than endPos value.
      Parameters:
      value - String to be checked
      beginPos - begining Position.
      endPos - end Position.
      Returns:
      String SubString .
      Throws:
      Exception
    • performSubstring

      public static String performSubstring(String value, Integer beginPos) throws Exception
      method that performs substring function based on specified begin position.
      Parameters:
      value - String to be checked
      beginPos - begining Position.
      Returns:
      String Substring
      Throws:
      Exception
    • performToUpperCase

      public static String performToUpperCase(String value)
      method that converts string to Upper case.
      Parameters:
      value - value.
      Returns:
      String value.
    • performToLowerCase

      public static String performToLowerCase(String value)
      method that converts string to Lower case.
      Parameters:
      value - String to be checked
      Returns:
      String in lower case
    • numberOfNumbersInString

      public static int numberOfNumbersInString(String value)
      Returns the number of numbers in the string
      Parameters:
      value - String to be checked
      Returns:
      Number of Numbers
    • containsNumber

      public static boolean containsNumber(String value) throws Exception
      Checks if the string contains any number
      Parameters:
      value - String to be checked
      Returns:
      boolean True, if String has numbers, else False
      Throws:
      Exception
    • numberOfAlphaInString

      public static int numberOfAlphaInString(String value) throws Exception
      Numbers of alphabets in a string
      Parameters:
      value - String to be checked
      Returns:
      number of alphabets in a string
      Throws:
      Exception
    • containsAlpha

      public static boolean containsAlpha(String value) throws Exception
      Checks if the String contains any alphabets in a string
      Parameters:
      value - String to be checked
      Returns:
      boolean True, if String has alphabets , else False
      Throws:
      Exception
    • containsAlphaNum

      public static boolean containsAlphaNum(String value) throws Exception
      Checks if the String contains any alphabets/numbers in a string
      Parameters:
      value - String to be checked
      Returns:
      boolean True, if String has alphabets/numbers , else False
      Throws:
      Exception
    • numberOfAlphaNumInString

      public static int numberOfAlphaNumInString(String value) throws Exception
      this method returns the numbers of alphabets + number of numbers in a string
      Parameters:
      value - String to be checked
      Returns:
      int numbers of alphabets + number
      Throws:
      Exception
    • performSpecialCharCheck

      public static boolean performSpecialCharCheck(String value) throws Exception
      Checks if the string has any special character in it. The list of special characters include "`,~,!,@,#,$,%,^,&,*,(,),-,_,=,+,[,{,],},|,;,:,\,",,>,<,.,?"
      Parameters:
      value - String to be checked
      Returns:
      boolean True, if String has special characters, else False
      Throws:
      Exception
    • numberOfSpecialCharInString

      public static int numberOfSpecialCharInString(String value) throws Exception
      returns the number of special characters in a string
      Parameters:
      value - String to be checked
      Returns:
      int Number of Special Characters
      Throws:
      Exception
    • performLowerCaseCheck

      public static boolean performLowerCaseCheck(String value) throws Exception
      Returns true if there is atleast one lowercase
      Parameters:
      string - to be checked
      Returns:
      boolean true is the String has a lower case letter, else false
      Throws:
      Exception
    • getStringLength

      public static int getStringLength(String psValue)
      method that returns length of the string passed it.
      Parameters:
      psValue - String .
      Returns:
      int length of the String passed .
    • getTrimmedStringLength

      public static int getTrimmedStringLength(String psValue)
      method that returns trimmed length of the string passed it.
      Parameters:
      psValue - Value to be trimmed .
      Returns:
      int length of the Trimmed String passed .
    • convertToString

      public static String convertToString(Object poValue)
      method that returns String representation of Object.
      Parameters:
      poValue - Object to be converted to the String .
      Returns:
      String Value of the object as String .
    • isInvalidCharacter

      public static boolean isInvalidCharacter(String psValue, char charToCheck)
      method that checks if the character exist in the string.
      Parameters:
      psValue - psValue string to check.
      charToCheck -
      Returns:
      char charToCheck character to check for.
    • isInputWithRepeatedConsecutiveCharacters

      public static boolean isInputWithRepeatedConsecutiveCharacters(String inputString)
      operation that does validation for repeatable consecutive characters.
      Parameters:
      inputString - inputString string to be tested.
      Returns:
      boolean true if present false if no repeatable consecutive characters.
    • getUniqueCharactersCount

      public static int getUniqueCharactersCount(String inputString)
      operation that does validation for unique characters count.
      Parameters:
      inputString - inputString string to be tested.
      Returns:
      integer, which gives the count of unique characters.
    • main

      public static void main(String[] arg)
      Main Method
      Parameters:
      arg -