Class 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 bytes
      static 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 algorithm
      static String EncodeBase64​(String xString)
      encrypts a string with Base64 algorithm
      static 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 case
      static String FormatNumber​(double xNumber, String xFormat)
      returns a string containing a number formatted according to the required format
      static 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 blank
      static boolean IsEmpty​(String xString)
      checks if a string is empty
      static boolean IsNotBlank​(String xString)
      checks if a string is not blank
      static boolean IsNotEmpty​(String xString)
      checks if a string is not empty
      static boolean IsWhitespace​(String xString, int xIndex)
      checks if a character at a given position is a whitespace
      static String LCase​(String xString)
      returns a string converted to lower case
      static String Left​(String xString, int xLength)
      returns a specified number of characters in a string from the left
      static int Len​(String xString)
      returns the length of a string
      static String LTrim​(String xString)
      removes whitespace to left
      static String MD5​(String xString)
      returns the MD5 hash of a string
      static String Mid​(String xString, int xStart, int xLength)
      returns a portion of a string
      static String Mid2​(String String1, int Start)
      returns a portion of a string
      static String ReformattingTextRows​(String xText, int xMaxRowLenght, String xCarriageReturnChar)
      returns a text reformatted
      static String[] RemoveElementsFromStringArray​(String[] xArray, String xStringSearch)
      removes from a string array all the items that match the search string
      static String Replace​(String xString, String xFind, String xReplacement)
      returns a string in which a specified substring has been replaced with another substring
      static String Replicate​(int xNumber, char xCharacter)
      returns a string of the same character repeated 'n' times
      static String Right​(String xString, int xLength)
      returns a specified number of characters in a string from the right
      static String RTrim​(String xString)
      removes whitespace to right
      static String SHA1​(String xString)
      returns a string processed with SHA1 algorithm
      static String Space​(int xNumber)
      returns a string of whitespace repeated 'n' times
      static String[] Split​(String xString, String xDelimiter)
      returns an array of substrings extracted from a string where the data were separated by a delimiter
      static int StrComp​(String xString1, String xString2, int xMethod)
      compares two strings
      static String String​(int xNumber, String xCharacter)
      returns a string of the same character repeated 'n' times
      static String StringAdjustment​(String xString, int xOutputLength, int xAdjustmentType, String xFillCharacter)
      returns a string adjusted as required
      static byte[] StringToByteArray​(String xString)
      returns a array of bytes from a string
      static String StripAccents​(String xString)
      returns a string without accent chars
      static String StrReverse​(String xString)
      returns a string in which the character order of the specified string is reversed
      static String Trim​(String xString)
      removes leading and trailing whitespace
      static String UCase​(String xString)
      returns a string converted to upper case
    • Constructor Detail

      • fSTRING

        public fSTRING()
    • 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 verify
        xString2 - 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 verify
        xString2 - 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 formatted
        xFormat - 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 search
        xString2 - 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 search
        xString1 - the string where to search
        xString2 - 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 search
        xString1 - the string where to search
        xString2 - the string to find
        xCompareMethod - 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 search
        xString2 - 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 search
        xString2 - the string to find
        xStart - 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 search
        xString2 - the string to find
        xStart - the starting position within the string search
        xCompareMethod - 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 verify
        xIndex - 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 returned
        xLength - 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 input
        xStart - the position where to start to take the characters
        the - 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 input
        xStart - 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 text
        xCarriageReturnChar - 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 input
        xFind - the substring to find
        xReplacement - 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 repeat
        xCharacter - 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 returned
        xLength - 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 data
        xDelimiter - the delimiter
      • StrComp

        public static int StrComp​(String xString1,
                                  String xString2,
                                  int xMethod)
        compares two strings
        Parameters:
        xString1 - the string to be compared
        xString2 - the string used for comparison
        xMethod - 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 repeat
        xCharacter - 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 input
        xOutputLength - the length of string in output
        xAdjustmentType - 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
      • UCase

        public static String UCase​(String xString)
        returns a string converted to upper case
        Parameters:
        xString - the string to be converted