StringExtra Object
'A string class encompassing a lot of string functionality
MyString As String
PatternPosition As Long 'you can read this after pattern matching
MatchMode As Long 'set this to 1 to find the smallest possible match with FindPattern. Defaults to 0, or finding the largest possible match.
'example
'"<!--*-->" would return all text between the first and last xml comments in the default mode, but would return the first comment in the "smallest" mode.
Sub SetString(str As String)
Function GetString() As String
Sub SetStringFrom(VBStringObj_String As VBString)
'Takes this objects string, and makes a byte array (supplied) from it.
Sub GetByteArray(MyArray() As Byte)
'Takes a byte array, and makes a string from it.
Sub SetArray(MyArray() As Byte)
'Get a byte array in a varient
Function GetArray() As Variant
Function length() As Long
Function SubString(ByVal start As Long, ByVal length As Long) As String
'returns the index where a subsrting is found in this objects string.
'index is 1 based.
Function IndexOf(StringToFind As String) As Long
'compares this string with the supplied string.
Function Compare(str As String) As Boolean
Sub Concat(str As String)
Function Contains(str As String) As Boolean
'Determines whether the end of this string instance matches the specified string.
Function EndsWith(str As String) As Boolean
' 0 Digit placeholder; prints a trailing or a leading zero in this position, if appropriate.
' # Digit placeholder; never prints trailing or leading zeros.
' . Decimal placeholder.
' , Thousands separator.
' - + $ ( ) space Literal character; characters are displayed exactly as typed into the format string.
' Constants...
' Currency Displays number with thousand separator, if appropriate; display two digits to the right of the decimal separator. Output is based on user’s system settings.
' Fixed Displays at least one digit to the left and two digits to the right of the decimal separator.
' Standard Displays number with thousand separator, at least one digit to the left and two digits to the righseparator.
' Percent Multiplies the value by 100 with a percent sign at the end.
' Scientific Uses standard scientific notation.
' General Date Shows date and time if expression contains both. If expression is only a date or a time, the missing information is not displayed. Date display is determined by user’s system settings.
' Long Date Uses the Long Date format specified
' by user’s system settings.
' Medium Date Uses the dd-mmm-yy format (for example, 03-Apr-93). Date display is determined by user’s system settings.
' Short Date Uses the Short Date format specified by user’s system settings.
' Long Time Displays a time using user’s system’s long-time format; includes hours, minutes, seconds.
' Medium Time Shows the hour, minute, and "AM" or "PM" using the "hh:mm AM/PM" format.
' Short time
Sub FormatString(fmt As String)
Sub Insert(str As String, pos As Long)
Function IsEmpty() As Boolean
'replace string 1 with string 2
'pos Optional. Position within expression where substring search is to begin. If omitted, 1 is assumed.
'count Optional. Number of substring substitutions to perform. If omitted, the default value is –1, which means make all possible
Sub ReplaceString(Str1 As String, str2 As String, Optional ByVal pos As Long = 1, Optional ByVal count As Long = 0)
'this should tokenize a string into a string array
'the array should be big enough to hold all the tokens, and zero based.
'see alose "SplitString" which is very similar and a little easier
Sub Tokenize(MyArray() As String, ByVal Delimiter As String)
Sub Uppercase()
Sub LowerCase()
'joins an array of strings into a single string (?)
Sub JoinString(Strings() As String, ByVal Delimiter As String)
'returns the split (tokenized) string in a variant, which represents an array of strings(?)
Function SplitString(ByVal Delimiter As String) As Variant
'remove extra spaces from this string
Sub Trim_()
'remove extra spaces from this string
Sub LTrim_()
'remove extra spaces from this string
Sub RTrim_()
'pattern matching type stuff.
'
' * matches any number of characters
' ? matches any 1 character
' [ ] matches any 1 character specified between the brackets
' - matches any range of characters e.g. [a-z] matches any non-capital 1 letter of the alphabet
' # matches any digit character
' Match ranges of characters by enclosing the range in brackets:
' [A-C] Matches any of A, B, or C
' [ABC] Same as [A-C]
' Match characters not in a range by using !
' [!A-Z] Any character not including A-Z
Function IsLike(s As String) As Boolean
'read a text file into the string
Sub ReadFile(FileName As String)
'pattern matching type stuff.
'
' * matches any number of characters
' ? matches any 1 character
' [ ] matches any 1 character specified between the brackets
' - matches any range of characters e.g. [a-z] matches any non-capital 1 letter of the alphabet
' # matches any digit character
' Match ranges of characters by enclosing the range in brackets:
' [A-C] Matches any of A, B, or C
' [ABC] Same as [A-C]
' Match characters not in a range by using !
' [!A-Z] Any character not including A-Z
Function FindPattern(Pattern As String) As String
'returns substring and position
'this will go until it finds the minimum matching pattern, but I think we want the maximum matching pattern. For example "*" should select the entire sting instead of the first thing it finds.
'so, first search for the miniumum match, then search until we no longer match.
'return the matching string(s)
'returns count and an array of substrings within a variant.
Function FindPatterns(ByVal Pattern As String) As Variant
'how to tell if something is a begin tag or end tag
'determin between a tag like this "<tag>" and this "</tag>"
Function IsbeginTag(tag As String) As Boolean
Function IsEndTag(tag As String) As Boolean
'Returns the string within a tag pair, such as "<dogument>This is my content</dogument"
'this would return "This is my content"
'the node may have other nodes nested within it. they are not removed.
'tag is the name of the node, not including the <> or </>
Function FindNodeByTag(ByVal tag As String, Optional ByVal RemoveTags As Boolean = True) As String
'returns one from a delimited string of options. such as choose_ (1, "one, two, three", ",") would return "one"
'this is similar to VB's "Choose" function, but accepts a single, delimited string instead of many separate ones.
Function Choose_(ByVal v As Long, choices As String, Delimiter As String) As String
'split a filename up into path and file. maybe in the future, extend it to split the extention as well...
Sub SplitPath(ByVal FileName As String, Path As String, File As String)
'remove all extra spaces from a text string, leaving only a single space if there were more than one in a row.
Function RemoveXtraSpaces(strVal As String) As String
'return the number of substrings within a string
Function TokenCount(ByVal txt As String, ByVal char As String) As Long
'convert a path name from another OS to Windows backslash style
Function ToWindowsPath(ByVal FileName As String) As String