Skip navigation links


com.thortech.xl.util.adapters
Class tcUtilStringOperations

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


public class tcUtilStringOperations
extends java.lang.Object

This class that has basic string operations utility methods. Author: Solomon Niyazov January 7, 2002.


Method Summary
static boolean containsAlpha(java.lang.String value)
          Checks if the String contains any alphabets in a string
static boolean containsAlphaNum(java.lang.String value)
          Checks if the String contains any alphabets/numbers in a string
static boolean containsNumber(java.lang.String value)
          Checks if the string contains any number
static java.lang.String convertToString(java.lang.Object poValue)
          method that returns String representation of Object.
static java.lang.String getRandomString(int len)
          method that returns a random string of the specified length.
static int getStringLength(java.lang.String psValue)
          method that returns length of the string passed it.
static int getTrimmedStringLength(java.lang.String psValue)
          method that returns trimmed length of the string passed it.
static int getUniqueCharactersCount(java.lang.String inputString)
          operation that does validation for unique characters count.
static java.lang.String holdData(java.lang.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.
static java.lang.String insertWhiteSpace(java.lang.String psInput, int pnOffset, int pnNumSpaces)
          method that insert whitespace character(s) into the specified string
static boolean isInputWithRepeatedConsecutiveCharacters(java.lang.String inputString)
          operation that does validation for repeatable consecutive characters.
static boolean isInvalidCharacter(java.lang.String psValue, char charToCheck)
          method that checks if the character exist in the string.
static void main(java.lang.String[] arg)
          Main Method
static int numberOfAlphaInString(java.lang.String value)
          Numbers of alphabets in a string
static int numberOfAlphaNumInString(java.lang.String value)
          this method returns the numbers of alphabets + number of numbers in a string
static int numberOfNumbersInString(java.lang.String value)
          Returns the number of numbers in the string
static int numberOfSpecialCharInString(java.lang.String value)
          returns the number of special characters in a string
static java.lang.String performConcat(java.lang.String value1, java.lang.String value2)
          method that performs concatenation of two strings.
static java.lang.String performConcatWithSpace(java.lang.String value1, java.lang.String value2)
          method that performs concatenation of two strings with a space in between
static boolean performLowerCaseCheck(java.lang.String value)
          Returns true if there is atleast one lowercase
static boolean performSpecialCharCheck(java.lang.String value)
          Checks if the string has any special character in it.
static java.lang.String performSubstring(java.lang.String value, int beginPos)
          method that performs substring function based on specified begin position.
static java.lang.String performSubstring(java.lang.String value, java.lang.Integer beginPos)
          method that performs substring function based on specified begin position.
static java.lang.String performSubstring(java.lang.String value, java.lang.Integer beginPos, java.lang.Integer endPos)
          method that performs substring function based on specified begin and end positions.
static java.lang.String performSubstring(java.lang.String value, int beginPos, int endPos)
          method that performs substring function based on specified begin and end positions.
static java.lang.String performSubstringLess(java.lang.String value, java.lang.Integer beginPos, java.lang.Integer endPos)
          method that performs substring function based on specified begin and end positions.
static java.lang.String performSubstringLess(java.lang.String value, int beginPos, int endPos)
          method that performs substring function based on specified begin and end positions.
static java.lang.String performToLowerCase(java.lang.String value)
          method that converts string to Lower case.
static java.lang.String performToUpperCase(java.lang.String value)
          method that converts string to Upper case.
static java.lang.String replaceWithWhitespace(java.lang.String psInput, char pcOldChar)
          method that replaces the specified character of a string with a whitespace character.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Method Detail

getRandomString

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

replaceWithWhitespace

public static java.lang.String replaceWithWhitespace(java.lang.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 java.lang.String insertWhiteSpace(java.lang.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 java.lang.String holdData(java.lang.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 java.lang.String performConcat(java.lang.String value1,
                                             java.lang.String value2)
method that performs concatenation of two strings.
Parameters:
value1 - value1.
value2 - value2.
Returns:
String value1+value2.

performConcatWithSpace

public static java.lang.String performConcatWithSpace(java.lang.String value1,
                                                      java.lang.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 java.lang.String performSubstringLess(java.lang.String value,
                                                    int beginPos,
                                                    int endPos)
                                             throws java.lang.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:
java.lang.Exception

performSubstring

public static java.lang.String performSubstring(java.lang.String value,
                                                int beginPos,
                                                int endPos)
                                         throws java.lang.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:
java.lang.Exception

performSubstring

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

performSubstring

public static java.lang.String performSubstring(java.lang.String value,
                                                java.lang.Integer beginPos,
                                                java.lang.Integer endPos)
                                         throws java.lang.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:
java.lang.Exception

performSubstringLess

public static java.lang.String performSubstringLess(java.lang.String value,
                                                    java.lang.Integer beginPos,
                                                    java.lang.Integer endPos)
                                             throws java.lang.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:
java.lang.Exception

performSubstring

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

performToUpperCase

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

performToLowerCase

public static java.lang.String performToLowerCase(java.lang.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(java.lang.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(java.lang.String value)
                              throws java.lang.Exception
Checks if the string contains any number
Parameters:
value - String to be checked
Returns:
boolean True, if String has numbers, else False
Throws:
java.lang.Exception

numberOfAlphaInString

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

containsAlpha

public static boolean containsAlpha(java.lang.String value)
                             throws java.lang.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:
java.lang.Exception

containsAlphaNum

public static boolean containsAlphaNum(java.lang.String value)
                                throws java.lang.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:
java.lang.Exception

numberOfAlphaNumInString

public static int numberOfAlphaNumInString(java.lang.String value)
                                    throws java.lang.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:
java.lang.Exception

performSpecialCharCheck

public static boolean performSpecialCharCheck(java.lang.String value)
                                       throws java.lang.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:
java.lang.Exception

numberOfSpecialCharInString

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

performLowerCaseCheck

public static boolean performLowerCaseCheck(java.lang.String value)
                                     throws java.lang.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:
java.lang.Exception

getStringLength

public static int getStringLength(java.lang.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(java.lang.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 java.lang.String convertToString(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.String[] arg)
Main Method
Parameters:
arg -

Skip navigation links


Copyright © 2014, Oracle and/or its affiliates. All rights reserved.