Package db2000.J.eXtrafunctions
Class fSTRING
- java.lang.Object
-
- db2000.J.eXtrafunctions.fSTRING
-
public class fSTRING extends Object
string functions
-
-
Constructor Summary
Constructors Constructor Description fSTRING()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
ByteArrayToString(byte[] xStringArray)
returns a string from a array of bytesstatic long
CalculateCheckSum(String xString, long xModule)
returns the calculation of checksum of a string (eg. xModule = 256, 512, 1024, ect.)static String
DecodeBase64(String xString)
decodes an encrypted string with Base64 algorithmstatic String
EncodeBase64(String xString)
encrypts a string with Base64 algorithmstatic boolean
Equals(String xString1, String xString2)
checks the equality between two strings (case sensitive)static boolean
EqualsIgnoreCase(String xString1, String xString2)
checks the equality between two strings ignoring upper and lower casestatic String
FormatNumber(double xNumber, String xFormat)
returns a string containing a number formatted according to the required formatstatic int
InStr(String xString1, String xString2)
returns the position of the first occurrence of a string within another (0 = not found)static int
InStr2(int xStart, String xString1, String xString2)
returns the position of the first occurrence of a string within another, starting from a predetermined position (0 = not found)static int
InStr3(int xStart, String xString1, String xString2, int xCompareMethod)
returns the position of the first occurrence of a string within another, starting from a predetermined position and with comparison method (0 = not found)static int
InStrRev(String xString1, String xString2)
returns the position of an occurrence of a string included in another from the end of the string (0 = not found)static int
InStrRev2(String xString1, String xString2, int xStart)
returns the position of an occurrence of a string included in another from the end of the string, starting from a predetermined position (0 = not found)static int
InStrRev3(String xString1, String xString2, int xStart, int xCompareMethod)
returns the position of an occurrence of a string included in another from the end of the string, starting from a predetermined position and with comparison method (0 = not found)static boolean
IsBlank(String xString)
checks if a string is blankstatic boolean
IsEmpty(String xString)
checks if a string is emptystatic boolean
IsNotBlank(String xString)
checks if a string is not blankstatic boolean
IsNotEmpty(String xString)
checks if a string is not emptystatic boolean
IsWhitespace(String xString, int xIndex)
checks if a character at a given position is a whitespacestatic String
LCase(String xString)
returns a string converted to lower casestatic String
Left(String xString, int xLength)
returns a specified number of characters in a string from the leftstatic int
Len(String xString)
returns the length of a stringstatic String
LTrim(String xString)
removes whitespace to leftstatic String
MD5(String xString)
returns the MD5 hash of a stringstatic String
Mid(String xString, int xStart, int xLength)
returns a portion of a stringstatic String
Mid2(String String1, int Start)
returns a portion of a stringstatic String
ReformattingTextRows(String xText, int xMaxRowLenght, String xCarriageReturnChar)
returns a text reformattedstatic String[]
RemoveElementsFromStringArray(String[] xArray, String xStringSearch)
removes from a string array all the items that match the search stringstatic String
Replace(String xString, String xFind, String xReplacement)
returns a string in which a specified substring has been replaced with another substringstatic String
Replicate(int xNumber, char xCharacter)
returns a string of the same character repeated 'n' timesstatic String
Right(String xString, int xLength)
returns a specified number of characters in a string from the rightstatic String
RTrim(String xString)
removes whitespace to rightstatic String
SHA1(String xString)
returns a string processed with SHA1 algorithmstatic String
Space(int xNumber)
returns a string of whitespace repeated 'n' timesstatic String[]
Split(String xString, String xDelimiter)
returns an array of substrings extracted from a string where the data were separated by a delimiterstatic int
StrComp(String xString1, String xString2, int xMethod)
compares two stringsstatic String
String(int xNumber, String xCharacter)
returns a string of the same character repeated 'n' timesstatic String
StringAdjustment(String xString, int xOutputLength, int xAdjustmentType, String xFillCharacter)
returns a string adjusted as requiredstatic byte[]
StringToByteArray(String xString)
returns a array of bytes from a stringstatic String
StripAccents(String xString)
returns a string without accent charsstatic String
StrReverse(String xString)
returns a string in which the character order of the specified string is reversedstatic String
Trim(String xString)
removes leading and trailing whitespacestatic String
UCase(String xString)
returns a string converted to upper case
-
-
-
Method Detail
-
ByteArrayToString
public static String ByteArrayToString(byte[] xStringArray)
returns a string from a array of bytes- Parameters:
xStringArray
- the array of bytes
-
CalculateCheckSum
public static long CalculateCheckSum(String xString, long xModule)
returns the calculation of checksum of a string (eg. xModule = 256, 512, 1024, ect.)
-
DecodeBase64
public static String DecodeBase64(String xString)
decodes an encrypted string with Base64 algorithm- Parameters:
xString
- the string to decode returns the decoded string
-
EncodeBase64
public static String EncodeBase64(String xString)
encrypts a string with Base64 algorithm- Parameters:
xString
- the string to be encrypted returns the encoded string
-
Equals
public static boolean Equals(String xString1, String xString2)
checks the equality between two strings (case sensitive)- Parameters:
xString1
- the string to verifyxString2
- the verification string returns [true] is equals, [false] not equals
-
EqualsIgnoreCase
public static boolean EqualsIgnoreCase(String xString1, String xString2)
checks the equality between two strings ignoring upper and lower case- Parameters:
xString1
- the string to verifyxString2
- the verification string returns [true] is equals, [false] not equals
-
FormatNumber
public static String FormatNumber(double xNumber, String xFormat)
returns a string containing a number formatted according to the required format- Parameters:
xNumber
- the number (double) to be formattedxFormat
- the required format
-
InStr
public static int InStr(String xString1, String xString2)
returns the position of the first occurrence of a string within another (0 = not found)- Parameters:
xString1
- the string where to searchxString2
- the string to find
-
InStr2
public static int InStr2(int xStart, String xString1, String xString2)
returns the position of the first occurrence of a string within another, starting from a predetermined position (0 = not found)- Parameters:
xStart
- the starting position within the string searchxString1
- the string where to searchxString2
- the string to find
-
InStr3
public static int InStr3(int xStart, String xString1, String xString2, int xCompareMethod)
returns the position of the first occurrence of a string within another, starting from a predetermined position and with comparison method (0 = not found)- Parameters:
xStart
- the starting position within the string searchxString1
- the string where to searchxString2
- the string to findxCompareMethod
- the comparison method (0 = binary, 1 = text)
-
InStrRev
public static int InStrRev(String xString1, String xString2)
returns the position of an occurrence of a string included in another from the end of the string (0 = not found)- Parameters:
xString1
- the string where to searchxString2
- the string to find
-
InStrRev2
public static int InStrRev2(String xString1, String xString2, int xStart)
returns the position of an occurrence of a string included in another from the end of the string, starting from a predetermined position (0 = not found)- Parameters:
xString1
- the string where to searchxString2
- the string to findxStart
- the starting position within the string search
-
InStrRev3
public static int InStrRev3(String xString1, String xString2, int xStart, int xCompareMethod)
returns the position of an occurrence of a string included in another from the end of the string, starting from a predetermined position and with comparison method (0 = not found)- Parameters:
xString1
- the string where to searchxString2
- the string to findxStart
- the starting position within the string searchxCompareMethod
- the comparison method (0 = binary, 1 = text)
-
IsBlank
public static boolean IsBlank(String xString)
checks if a string is blank- Parameters:
xString
- the string to verify returns [true] is blank, [false] is not blank
-
IsEmpty
public static boolean IsEmpty(String xString)
checks if a string is empty- Parameters:
xString
- the string to verify returns [true] is empty, [false] is not empty
-
IsNotBlank
public static boolean IsNotBlank(String xString)
checks if a string is not blank- Parameters:
xString
- the string to verify returns [true] is not blank, [false] is blank
-
IsNotEmpty
public static boolean IsNotEmpty(String xString)
checks if a string is not empty- Parameters:
xString
- the string to verify returns [true] is not empty, [false] is empty
-
IsWhitespace
public static boolean IsWhitespace(String xString, int xIndex)
checks if a character at a given position is a whitespace- Parameters:
xString
- the string to verifyxIndex
- the character position within the string returns [true] is a whitespace, [false] is not a whitespace
-
LCase
public static String LCase(String xString)
returns a string converted to lower case- Parameters:
xString
- the string to be converted
-
Len
public static int Len(String xString)
returns the length of a string- Parameters:
xString
- the string
-
Left
public static String Left(String xString, int xLength)
returns a specified number of characters in a string from the left- Parameters:
xString
- string from which the characters located at the far left are returnedxLength
- integer that indicates how many characters are to be returned
-
LTrim
public static String LTrim(String xString)
removes whitespace to left- Parameters:
xString
- the string to be trimmed returns the trimmed result
-
MD5
public static String MD5(String xString)
returns the MD5 hash of a string- Parameters:
xString
- the string in input returns the string processed
-
Mid
public static String Mid(String xString, int xStart, int xLength)
returns a portion of a string- Parameters:
xString
- the string in inputxStart
- the position where to start to take the charactersthe
- number of characters to be taken
-
Mid2
public static String Mid2(String String1, int Start)
returns a portion of a string- Parameters:
xString
- the string in inputxStart
- the position where to start to take the characters until to reach the end of the string
-
ReformattingTextRows
public static String ReformattingTextRows(String xText, int xMaxRowLenght, String xCarriageReturnChar)
returns a text reformatted- Parameters:
xText
- the input text (alphanumeric strings even with carriage return)xMaxRowLenght
- the maximum length of each row of the output textxCarriageReturnChar
- the character(s) to be used as carriage return in each row the output text
-
RemoveElementsFromStringArray
public static String[] RemoveElementsFromStringArray(String[] xArray, String xStringSearch)
removes from a string array all the items that match the search string
-
Replace
public static String Replace(String xString, String xFind, String xReplacement)
returns a string in which a specified substring has been replaced with another substring- Parameters:
xString
- the string in inputxFind
- the substring to findxReplacement
- the replacement substring
-
Replicate
public static String Replicate(int xNumber, char xCharacter)
returns a string of the same character repeated 'n' times- Parameters:
xNumber
- the number of times to repeatxCharacter
- the character to repeat
-
Right
public static String Right(String xString, int xLength)
returns a specified number of characters in a string from the right- Parameters:
xString
- string from which the characters located at the far right are returnedxLength
- integer that indicates how many characters are to be returned
-
RTrim
public static String RTrim(String xString)
removes whitespace to right- Parameters:
xString
- the string to be trimmed returns the trimmed result
-
SHA1
public static String SHA1(String xString)
returns a string processed with SHA1 algorithm- Parameters:
xString
- the string in input
-
Space
public static String Space(int xNumber)
returns a string of whitespace repeated 'n' times- Parameters:
xNumber
- the number of whitespace to repeat
-
Split
public static String[] Split(String xString, String xDelimiter)
returns an array of substrings extracted from a string where the data were separated by a delimiter- Parameters:
xString
- the string containing delimited dataxDelimiter
- the delimiter
-
StrComp
public static int StrComp(String xString1, String xString2, int xMethod)
compares two strings- Parameters:
xString1
- the string to be comparedxString2
- the string used for comparisonxMethod
- the comparison type (0 = binary, 1 = text) returns -1 = xString1 greater than xString2, 0 = the two strings are equal, 1 = xString1 less than xString2
-
String
public static String String(int xNumber, String xCharacter)
returns a string of the same character repeated 'n' times- Parameters:
xNumber
- the number of times to repeatxCharacter
- the character to repeat
-
StringAdjustment
public static String StringAdjustment(String xString, int xOutputLength, int xAdjustmentType, String xFillCharacter)
returns a string adjusted as required- Parameters:
xString
- the string in inputxOutputLength
- the length of string in outputxAdjustmentType
- the type of adjustment (0 = left, 1 = right, 2 = middle, 3 = all trim, >3 = none)xFillCharacter
- the fill character
-
StringToByteArray
public static byte[] StringToByteArray(String xString)
returns a array of bytes from a string- Parameters:
xString
- the string in input
-
StripAccents
public static String StripAccents(String xString)
returns a string without accent chars- Parameters:
xString
- the string in input
-
StrReverse
public static String StrReverse(String xString)
returns a string in which the character order of the specified string is reversed- Parameters:
xString
- the string in input
-
Trim
public static String Trim(String xString)
removes leading and trailing whitespace- Parameters:
xString
- the string to be trimmed returns the trimmed result
-
-