Class Module
49 Members
★ 1 Top 20
String Manipulations Class
Entisoft Tools 2.0 Object Library · StringManipulations · 41 Functions · 0 Properties · 7 Subroutines
Declarations
Declarations
The functions and subroutines within this group perform various string manipulations that usually do not involve search and/or replacement. Copyright 1998 Entisoft
Section
CharacterEveryNthCharacter
Character Every Nth Character
Extracts characters from a string by stepping through it vStep positions at a time. Stops when the beginning or end of the source string vString is reached. Inverse of the MergeStrings function.
Function
CompareStrings
Compare Strings
Indicate which portions of two strings are the same. Includes the original strings and the marker string all separated by carriage return and line feed characters. Indicates matches with a caret character ("^") in the marker string and indicates differences with a space (" ").
Function
CompressSpaces
Compress Spaces
Compresses all whitespace down to a single space character. Replaces all repeated runs of space-type characters (space, tab, carriage return, etc.) with a single space character. Uses the IsSpace function with the currently-loaded character classifications to determine which characters are considered "space".
Function
ContrastStrings
Contrast Strings
Indicate which portions of two strings are the same. Includes the original strings and the marker string all separated by carriage return and line feed characters. Indicates differences with a caret character ("^") in the marker string and indicates matches with a space (" ").
Function
DeleteString
Delete String
Returns the string vString with a portion of the string removed. Removes the portion of vString beginning at character position vStartPos with a length of vLength.
Function
DifferenceString
Difference String
Returns a string with different characters describing the matching and non-matching portions of the two strings. The character at a specific position within the returned string describes whether characters at the same corresponding positions within vStringOne and vStringTwo match each other.
Function
DoubleQuoteString
Double Quote String
Surrounds a string with double-quote characters ("). Replaces each double-quote character within the string with two double-quote characters.
Function
GrepToLike
Grep To Like
"UNIX grep To Visual Basic LIKE" Fixes up some limited forms of wildcards from one style (UNIX) to another (Microsoft). Accepts a wildcard that is more like those recognized by UNIX and returns the corresponding wildcard/pattern recognized by the Microsoft's LIKE operator.
Function
HashString
Hash String
Return a hash value for the specified string. Converts a string into a numeric identifier that is likely unique, given an appropriate value for vRangePrimeNumber. The number returned will be between 0 (zero) and vRangePrimeNumber - 1.
★ Top 20
Function
HashStringFast
Hash String Fast
Return a hash value for the specified string. Converts a string into a numeric identifier that is likely unique, given an appropriate value for vRangePrimeNumber. "Fast" version of the HashString function which has restrictive argument types. See the HashString function for details.
Function
InsertString
Insert String
Insert one string into the middle of another string and return the results. vSource is inserted into vDest before character position vInsertPosition.
Function
MergeStrings
Merge Strings
Creates a string by interspersing the characters from the two input strings. Inverse of the SplitStrings and CharacterEveryNthCharacter functions.
Function
MidReverse
Mid Reverse
"Middle String Reverse" Similar to the Visual Basic Mid function, except that the returned string is constructed by moving backwards through vString instead of forwards.
Function
MidString
Mid String
"Middle String" Like the Visual Basic Mid function, except that the vStart can be negative.
Function
OverlayString
Overlay String
Overlays the string vFm on top of string vTo at an offset of vOffset. Any portion of vFm which, when overlaid onto vTo at an offset of vOffset, would be before the beginning of vTo or past its end is ignored/truncated.
Function
QuoteString
Quote String
Surrounds a string with some "quote" character. Replaces each "quote" character within the string with two "quote" characters.
Function
RepeatString
Repeat String
Like the Visual Basic String$() function, except all of the characters in the string are repeated instead of only the first character within the string.
Function
RepeatStringCharacters
Repeat String Characters
Creates a string by repeating each of the characters in vStringChars. Each character within vStringChars is repeated the specified number of times before the succeeding character is repeated.
Function
RepeatStringToLength
Repeat String To Length
Like the built-in String$() function, except all of the characters in the string are repeated until string is of length vLength.
Function
ReverseEveryNCharacters
Reverse Every N Characters
Reverse the characters within every set of characters of length vSize.
Function
ReverseString
Reverse String
Reverse the characters within a string. "ABCDEF" becomes "FEDCBA", etc.
Function
RotateString
Rotate String
Rotates the characters within a string after some specified character position.
Function
RotateStringLeft
Rotate String Left
Rotates the characters within a string to the left by vPositions, taking the first vPositions characters within the string and placing them at the end of the string.
Function
RotateStringRight
Rotate String Right
Rotates the characters within a string to the right by vPositions, taking the last vPositions characters within the string and placing them at the beginning of the string.
Function
SeparateCharactersIntoNGroups
Separate Characters Into N Groups
Forms the characters of vString into separate groups (lines, words, etc.), with the 1st character going into the 1st position in line #1, the 2nd character going into the 1st position in line #2, the 3rd character going into the 2nd position in line #1, etc. Similar to the StringEveryNthCharRepeated function.
Function
ShiftStringLeft
Shift String Left
Shifts the characters within a string to the left by vPositions. Same as removing the first vPositions characters from vValue.
Function
ShiftStringRight
Shift String Right
Shifts the characters within a string to the right by vPositions. Same as removing the last vPositions characters from vValue.
Function
SplitStrings
Split Strings
Takes the characters in odd-numbered positions within string vValue and places them within rOddPosChars and takes the characters in even-numbered positions within vValue and places then within rEvenPosChars.
Function
StringEveryNthCharacter
String Every Nth Character
Steps forward through vString creating a string from all of the sub-strings of length vLength. Starts at character position vStep. If vTruncate is True, then the final sub-string will be truncated unless it is of length vLength.
Function
StringEveryNthCharRepeated
String Every Nth Char Repeated
"String Every Nth Character Repeated" Creates the string resulting from taking the character at position 1 (one) and at every Nth succeeding position (where N = vStep), then by repeating this process until the start position is equal to the vStep.
Function
StringPastMinLength
String Past Min Length
"String Past Minimum Length" Returns the part of the longer string that is beyond the length of the smaller string. If the lengths of the strings match, then return an empty string.
Function
StringRotateLeft
String Rotate Left
Rotates the characters within a string one position to the left, with the character at the beginning of the string being added onto the end of the string. Returns the ASCII value of the character at the beginning of string rValue. (The character at the beginning of the string before the characters are rotated).
Function
StringRotateRight
String Rotate Right
Rotates the characters within a string one position to the right, with the character at the end of the string being added onto the beginning of the string. Returns the ASCII value of the character at the end of string rValue. (The character at the end of the string before the characters are rotated).
Function
StringShiftLeft
String Shift Left
Shifts the characters within a string one position to the left, with the character at the beginning of the string being removed. Returns the ASCII value of the character at the beginning of string rValue. (The character at the beginning of the string before the characters are shifted).
Function
StringShiftRight
String Shift Right
Shifts the characters within a string one position to the right, with the character at the end of the string being removed. Returns the ASCII value of the character at the end of string rValue. (The character at the end of the string before the characters are shifted).
Function
StripDoubleQuotes
Strip Double Quotes
Strips surrounding double-quote characters from a string (if they exist).
Function
StripLeftNCharacters
Strip Left N Characters
Return the string vString with vNumChars characters removed from the left side of it.
Function
StripRightNCharacters
Strip Right N Characters
Return the string vString with vNumChars characters removed from the right side of it.
Function
SwapCharacters
Swap Characters
Swaps every other character within a string, so "ABCD" becomes "BADC". Strings with an odd number of characters have their last character retained. as in example #2.
Function
TruncateLeftWithEllipse
Truncate Left With Ellipse
Truncate/remove the left part of the string vLine if it is longer than vMaxLen, If the string is truncated, replace the leading characters with "..." to indicate the removal.
Function
TruncateRightWithEllipse
Truncate Right With Ellipse
Truncate the left of a string if it is longer than MaxLen, If the string is truncated, replace the leading characters with "..." to indicate the removal.
Function
Cat
Cat
"Concatenate" Concatenate the string representation of a value onto the end of a string.
Sub
CatLine
Cat Line
"Concatenate Line" Add a line of text onto the end of a string representing a paragraph. Concatenate the string representation of a value onto the end of a string, preceded by carriage return and new line characters unless the target string rTo is empty.
Sub
CharacterEveryNthCharacterSample
Character Every Nth Character Sample
View VB6 signature, parameters, and usage notes.
Sub
SplitStringsSample
Split Strings Sample
View VB6 signature, parameters, and usage notes.
Sub
StrDel
Str Del
"String Delete" Remove some number of characters from a string starting at a specific position and going forward.
Sub
StringEveryNthCharacterSample
String Every Nth Character Sample
View VB6 signature, parameters, and usage notes.
Sub
StrIns
Str Ins
"String Insert" Insert one string into the middle of another string. vSource is inserted into vDest before character position vInsertPosition. Similar to the InsertString function, except that this is a Subroutine which modifies its first argument instead of returning a value.
Sub