### StartsWith Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Determines whether this string instance starts with the specified character or string. ```APIDOC ## StartsWith(Char) ### Description Determines whether this string instance starts with the specified character. ### Parameters #### Path Parameters - **value** (Char) - Required - The character to check for. ### Method [Implicitly a method of a string object] ### Endpoint [N/A - SDK/Library Function] ``` ```APIDOC ## StartsWith(String) ### Description Determines whether the beginning of this string instance matches the specified string. ### Parameters #### Path Parameters - **value** (String) - Required - The string to compare to the beginning of this instance. ### Method [Implicitly a method of a string object] ### Endpoint [N/A - SDK/Library Function] ``` ```APIDOC ## StartsWith(String, Boolean, CultureInfo) ### Description Determines whether the beginning of this string instance matches the specified string when compared using the specified culture. ### Parameters #### Path Parameters - **value** (String) - Required - The string to compare to the beginning of this instance. - **ignoreCase** (Boolean) - Required - True to ignore case during comparison; otherwise, false. - **culture** (CultureInfo) - Required - An object that provides culture-specific comparison information. ### Method [Implicitly a method of a string object] ### Endpoint [N/A - SDK/Library Function] ``` ```APIDOC ## StartsWith(String, StringComparison) ### Description Determines whether the beginning of this string instance matches the specified string when compared using the specified comparison option. ### Parameters #### Path Parameters - **value** (String) - Required - The string to compare to the beginning of this instance. - **comparisonType** (StringComparison) - Required - An enumeration value that specifies the culture, case, and sort rules to be used in the comparison. ### Method [Implicitly a method of a string object] ### Endpoint [N/A - SDK/Library Function] ``` -------------------------------- ### Check if String Starts With Any of a List Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/AboutStrings.md Use Strings.StartsWithAny to determine if a string begins with any of the substrings provided in an array. Returns TRUE if a match is found, FALSE otherwise. ```VB stringstoFind = Array("one","two","three","four") Strings.StartsWithAny("fourth test string", stringsToFind) '-> Returns TRUE ``` -------------------------------- ### JoinBetween Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Concatenates a specified number of elements from an array of strings, using the specified separator, starting from a specified position. ```APIDOC ## Join(Char, String[], Int32, Int32) ### Description Concatenates an array of strings, using the specified separator between each member, starting with the element in value located at the startIndex position, and concatenating up to count elements. ``` -------------------------------- ### Instantiate StringBuilder Object Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/AboutStringBuilder.md Import the StringBuilder.cls module and then create a new instance of the StringBuilder class. ```VB Dim sb As StringBuilder Set sb = new StringBuilder ``` -------------------------------- ### TrimStart Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Removes leading whitespace characters or specified characters from a string. ```APIDOC ## TrimStart() ### Description Removes all the leading white-space characters from the current string. ### Method TrimStart ## TrimStart(Char) ### Description Removes all the leading occurrences of a specified character from the current string. ### Method TrimStart ### Parameters #### Path Parameters - **trimChar** (Char) - Required - The character to remove. ## TrimStart(Char[]) ### Description Removes all the leading occurrences of a set of characters specified in an array from the current string. ### Method TrimStart ### Parameters #### Path Parameters - **trimChars** (Char[]) - Required - An array of characters to remove. ``` -------------------------------- ### Remove Text from StringBuilder Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/AboutStringBuilder.md Use the Remove method to delete characters from a specified starting index for a given length. ```VB sb.Remove 0, 4 '->"inserted text" ``` -------------------------------- ### ToString Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Returns the string itself. Overloads exist for specifying a format provider, but no actual conversion is performed. ```APIDOC ## ToString() ### Description Returns this instance of String; no actual conversion is performed. ### Method ToString ## ToString(IFormatProvider) ### Description Returns this instance of String; no actual conversion is performed. ### Method ToString ### Parameters #### Path Parameters - **formatProvider** (IFormatProvider) - Required - The object that provides culture-specific formatting information. ``` -------------------------------- ### IndexOfAny Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Reports the zero-based index of the first occurrence of any character from a specified array within this string, with options for starting position and length. ```APIDOC ## IndexOfAny(Char[]) ### Description Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. ## IndexOfAny(Char[], Int32) ### Description Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. The search starts at a specified character position. ## IndexOfAny(Char[], Int32, Int32) ### Description Reports the zero-based index of the first occurrence in this instance of any character in a specified array of Unicode characters. The search starts at a specified character position and examines a specified number of character positions. ``` -------------------------------- ### CompareTo(Object) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Compares this instance with a specified Object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified Object. ```APIDOC ## CompareTo(Object) ### Description Compares this instance with a specified Object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified Object. ### Method Not applicable (Instance method) ### Parameters - **value** (Object) - The object to compare with the current instance. ### Request Example ```vba Dim str1 As String Dim str2 As Object str1 = "hello" str2 = "hello" Dim result As Integer result = str1.CompareTo(str2) ' result will be 0 ``` ### Response #### Success Response (Integer) - **Integer**: A value indicating the lexical relationship between the current instance and the value parameter: - Less than 0: The current instance precedes value. - 0: The current instance is equal to value. - Greater than 0: The current instance follows value. ### Response Example ```vba 0 ``` ``` -------------------------------- ### LastIndexOf Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Reports the zero-based index of the last occurrence of a specified character or string within this instance, potentially with a starting position or comparison type. ```APIDOC ## LastIndexOf(Char) ### Description Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance. ### Parameters - **value** (Char) - The Unicode character to seek. ### Returns The zero-based index position of the last occurrence of value if found; otherwise, -1. ## LastIndexOf(Char, Int32) ### Description Reports the zero-based index position of the last occurrence of a specified Unicode character within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string. ### Parameters - **value** (Char) - The Unicode character to seek. - **startIndex** (Int32) - The position to start the search backward from. ### Returns The zero-based index position of the last occurrence of value if found; otherwise, -1. ## LastIndexOf(String) ### Description Reports the zero-based index position of the last occurrence of a specified string within this instance. ### Parameters - **value** (String) - The string to seek. ### Returns The zero-based index position of the last occurrence of value if found; otherwise, -1. ## LastIndexOf(String, Int32) ### Description Reports the zero-based index position of the last occurrence of a specified string within this instance. The search starts at a specified character position and proceeds backward toward the beginning of the string. ### Parameters - **value** (String) - The string to seek. - **startIndex** (Int32) - The position to start the search backward from. ### Returns The zero-based index position of the last occurrence of value if found; otherwise, -1. ## LastIndexOf(String, Int32, StringComparison) ### Description Reports the zero-based index of the last occurrence of a specified string within the current String object. The search starts at a specified character position and proceeds backward toward the beginning of the string. A parameter specifies the type of comparison to perform when searching for the specified string. ### Parameters - **value** (String) - The string to seek. - **startIndex** (Int32) - The position to start the search backward from. - **comparisonType** (StringComparison) - An enumeration that specifies the rules for this string to be searched. ### Returns The zero-based index position of the last occurrence of value if found; otherwise, -1. ## LastIndexOf(String, StringComparison) ### Description Reports the zero-based index of the last occurrence of a specified string within the current String object. A parameter specifies the type of search to use for the specified string. ### Parameters - **value** (String) - The string to seek. - **comparisonType** (StringComparison) - An enumeration that specifies the rules for this string to be searched. ### Returns The zero-based index position of the last occurrence of value if found; otherwise, -1. ``` -------------------------------- ### CompareTo(String) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Compares this instance with a specified String object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified string. ```APIDOC ## CompareTo(String) ### Description Compares this instance with a specified String object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified string. ### Method Not applicable (Instance method) ### Parameters - **value** (String) - The string to compare with the current instance. ### Request Example ```vba Dim str1 As String Dim str2 As String str1 = "hello" str2 = "world" Dim result As Integer result = str1.CompareTo(str2) ' result will be negative because "hello" precedes "world" ``` ### Response #### Success Response (Integer) - **Integer**: A value indicating the lexical relationship between the current instance and the value parameter: - Less than 0: The current instance precedes value. - 0: The current instance is equal to value. - Greater than 0: The current instance follows value. ### Response Example ```vba -1 ``` ``` -------------------------------- ### IndexOf Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Reports the zero-based index of the first occurrence of a specified character or string within this string, with options for starting position and comparison type. ```APIDOC ## IndexOf(Char) ### Description Reports the zero-based index of the first occurrence of the specified Unicode character in this string. ## IndexOf(Char, Int32) ### Description Reports the zero-based index of the first occurrence of the specified Unicode character in this string. The search starts at a specified character position. ## IndexOf(Char, StringComparison) ### Description Reports the zero-based index of the first occurrence of the specified Unicode character in this string. A parameter specifies the type of search to use for the specified character. ## IndexOf(String) ### Description Reports the zero-based index of the first occurrence of the specified string in this instance. ## IndexOf(String, Int32) ### Description Reports the zero-based index of the first occurrence of the specified string in this instance. The search starts at a specified character position. ## IndexOf(String, Int32, StringComparison) ### Description Reports the zero-based index of the first occurrence of the specified string in the current String object. Parameters specify the starting search position in the current string and the type of search to use for the specified string. ## IndexOf(String, StringComparison) ### Description Reports the zero-based index of the first occurrence of the specified string in the current String object. A parameter specifies the type of search to use for the specified string. ``` -------------------------------- ### StartsWith / EndsWith / StartsWithAny / EndsWithAny Source: https://context7.com/noah-severyn/vba-strings/llms.txt Performs boundary checks on strings. `StartsWith` and `EndsWith` check if a string begins or ends with a specified value. The `Any` variants check against an array or `Collection` for the first match. ```APIDOC ## StartsWith / EndsWith / StartsWithAny / EndsWithAny — Boundary checks Return `True` if a string starts or ends with the specified value. The `Any` variants accept an array or `Collection` and return `True` on the first match. ```vb Strings.StartsWith("Hello World", "Hello") ' -> True Strings.StartsWith("Hello World", "World") ' -> False Strings.EndsWith("Hello World", "World") ' -> True ' Case-insensitive Strings.StartsWith("HELLO", "hello", StringComparison.BinaryIgnoreCase) ' -> True ' Any variant Dim prefixes() As String: prefixes = Array("Mr", "Ms", "Dr", "Prof") Strings.StartsWithAny("Dr. Smith", prefixes) ' -> True Strings.StartsWithAny("Bob Jones", prefixes) ' -> False Dim exts() As String: exts = Array(".xlsx", ".xls", ".csv") Strings.EndsWithAny("report.csv", exts) ' -> True ``` ``` -------------------------------- ### IndexOfBetween Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Reports the zero-based index of the first occurrence of a specified character or string within a portion of this string, with options for starting position, length, and comparison type. ```APIDOC ## IndexOf(Char, Int32, Int32) ### Description Reports the zero-based index of the first occurrence of the specified character in this instance. The search starts at a specified character position and examines a specified number of character positions. ## IndexOf(String, Int32, Int32) ### Description Reports the zero-based index of the first occurrence of the specified string in this instance. The search starts at a specified character position and examines a specified number of character positions. ## IndexOf(String, Int32, Int32, StringComparison) ### Description Reports the zero-based index of the first occurrence of the specified string in the current String object. Parameters specify the starting search position in the current string, the number of characters in the current string to search, and the type of search to use for the specified string. ``` -------------------------------- ### Clone() Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Returns a reference to this instance of String. ```APIDOC ## Clone() ### Description Returns a reference to this instance of String. ### Method Not applicable (Instance method) ### Parameters None ### Response #### Success Response - **String**: A reference to the current String instance. ### Request Example ```vba Dim originalString As String Dim clonedString As String originalString = "Hello" clonedString = originalString.Clone() ' clonedString will be "Hello" ``` ### Response Example ```vba "Hello" ``` ``` -------------------------------- ### Remove / RemoveFromEndWhile Source: https://context7.com/noah-severyn/vba-strings/llms.txt Deletes characters from a string. `Remove` deletes a specified count of characters starting at a given index. `RemoveFromEndWhile` repeatedly strips a trailing pattern until it no longer appears. ```APIDOC ## Remove / RemoveFromEndWhile — Delete characters `Remove` deletes `count` characters starting at 0-based `startIndex`. If `count` exceeds the remaining length, it is silently capped. `RemoveFromEndWhile` repeatedly strips a trailing pattern until it no longer appears. ```vb ' Remove by position and count Strings.Remove("Hello, World!", 5, 2) ' -> "Hello World!" (removes ", ") Strings.Remove("abcdef", 2) ' -> "ab" (remove from index 2 to end) ' RemoveFromEndWhile strips repeating trailing pattern Strings.RemoveFromEndWhile("data,,,", ",") ' -> "data" Strings.RemoveFromEndWhile("item....", ".") ' -> "item" Strings.RemoveFromEndWhile("noop", "x") ' -> "noop" (pattern not present) ``` ``` -------------------------------- ### Substring / SubstringBetween Source: https://context7.com/noah-severyn/vba-strings/llms.txt Extracts portions of a string. `Substring` extracts a specified number of characters starting from a given index. `SubstringBetween` extracts text located between two specified delimiter strings. ```APIDOC ## Substring / SubstringBetween — Extract portions `Substring` extracts from a 0-based `startIndex` for `count` characters (or to the end if omitted). `SubstringBetween` extracts the text between two delimiter strings. ```vb Dim s As String: s = "Hello, World!" ' Substring from index 7 to end Strings.Substring(s, 7) ' -> "World!" ' Substring from index 7 for 5 chars Strings.Substring(s, 7, 5) ' -> "World" ' SubstringBetween markers Strings.SubstringBetween("bold text", "", "") ' -> "bold text" ' Extract between repeated delimiters with startIndex offset Dim csv As String: csv = "[alpha],[beta],[gamma]" Strings.SubstringBetween(csv, "[", "]", 0) ' -> "alpha" Strings.SubstringBetween(csv, "[", "]", 8) ' -> "beta" ``` ``` -------------------------------- ### Compare(String, String, CultureInfo, CompareOptions) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Compares two specified String objects using the specified comparison options and culture-specific information to influence the comparison, and returns an integer that indicates the relationship of the two strings to each other in the sort order. ```APIDOC ## Compare(String, String, CultureInfo, CompareOptions) ### Description Compares two specified String objects using the specified comparison options and culture-specific information to influence the comparison, and returns an integer that indicates the relationship of the two strings to each other in the sort order. ### Method Not applicable (Static method) ### Parameters - **strA** (String) - The first string to compare. - **strB** (String) - The second string to compare. - **culture** (CultureInfo) - An object that provides culture-specific comparison information. - **options** (CompareOptions) - Flags that specify whether to ignore case or the type of comparison. ### Request Example ```vba ' Assuming cultureInfo is a valid CultureInfo object and compareOptions is a valid CompareOptions value Dim result As Integer result = Strings.Compare("Apple", "apple", cultureInfo, compareOptions) ' result depends on the cultureInfo and compareOptions ``` ### Response #### Success Response (Integer) - **Integer**: A value indicating the lexical relationship between the two strings: - Less than 0: strA precedes strB. - 0: strA and strB are equal. - Greater than 0: strA follows strB. ### Response Example ```vba 0 ``` ``` -------------------------------- ### Coalesce: Get the first non-null value in VBA Source: https://context7.com/noah-severyn/vba-strings/llms.txt Returns the first argument that is not `vbNullString` or `Null`. Useful as a VBA equivalent of SQL's `COALESCE`. Use to provide default values. ```vb Strings.Coalesce(vbNullString, "", "fallback", "other") ' -> "fallback" Strings.Coalesce("first", "second") ' -> "first" Strings.Coalesce(vbNullString, vbNullString) ' -> "" (all null) ``` -------------------------------- ### Format(IFormatProvider, String, Object, Object, Object) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Replaces the format items in a string with the string representation of three specified objects. An parameter supplies culture-specific formatting information. ```APIDOC ## Format(IFormatProvider, String, Object, Object, Object) ### Description Replaces the format items in a string with the string representation of three specified objects. An parameter supplies culture-specific formatting information. ### Method Not applicable (function call) ### Parameters - **IFormatProvider** (IFormatProvider object) - An object that supplies culture-specific formatting information. - **String** (String) - A composite format string. - **Object** (Object) - The first object to format. - **Object** (Object) - The second object to format. - **Object** (Object) - The third object to format. ### Response - **String** - A new string that is identical to format or is a null reference if format is null, and whose elements are replaced by the string representation of the corresponding argument of this instance. ``` -------------------------------- ### Create(Int32, TState, SpanAction) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Creates a new string with a specific length and initializes it after creation by using the specified callback. ```APIDOC ## Create(Int32, TState, SpanAction) ### Description Creates a new string with a specific length and initializes it after creation by using the specified callback. ### Method Not applicable (function call) ### Parameters - **Int32** (Integer) - The desired length of the new string. - **TState** (Generic Type) - The state object to pass to the callback. - **SpanAction** (Delegate) - The callback action that populates the string. ### Response - **String** - The newly created string. ``` -------------------------------- ### Extract Substrings in VBA Source: https://context7.com/noah-severyn/vba-strings/llms.txt Substring extracts a portion of a string by start index and count. SubstringBetween extracts text delimited by two specified strings, supporting startIndex offsets for repeated delimiters. ```vb Dim s As String: s = "Hello, World!" ' Substring from index 7 to end Strings.Substring(s, 7) ' -> "World!" ' Substring from index 7 for 5 chars Strings.Substring(s, 7, 5) ' -> "World" ' SubstringBetween markers Strings.SubstringBetween("bold text", "", "") ' -> "bold text" ' Extract between repeated delimiters with startIndex offset Dim csv As String: csv = "[alpha],[beta],[gamma]" Strings.SubstringBetween(csv, "[", "]", 0) ' -> "alpha" Strings.SubstringBetween(csv, "[", "]", 8) ' -> "beta" ``` -------------------------------- ### Remove Characters from String in VBA Source: https://context7.com/noah-severyn/vba-strings/llms.txt Use Remove to delete a specified number of characters starting from a given index. If the count exceeds remaining length, it's capped. RemoveFromEndWhile strips a trailing pattern until it's no longer present. ```vb ' Remove by position and count Strings.Remove("Hello, World!", 5, 2) ' -> "Hello World!" (removes ", ") Strings.Remove("abcdef", 2) ' -> "ab" (remove from index 2 to end) ' RemoveFromEndWhile strips repeating trailing pattern Strings.RemoveFromEndWhile("data,,,", ",") ' -> "data" Strings.RemoveFromEndWhile("item....", ".") ' -> "item" Strings.RemoveFromEndWhile("noop", "x") ' -> "noop" (pattern not present) ``` -------------------------------- ### Compare(String, Int32, String, Int32, Int32, CultureInfo, CompareOptions) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Compares substrings of two specified String objects using the specified comparison options and culture-specific information to influence the comparison, and returns an integer that indicates the relationship of the two substrings to each other in the sort order. ```APIDOC ## Compare(String, Int32, String, Int32, Int32, CultureInfo, CompareOptions) ### Description Compares substrings of two specified String objects using the specified comparison options and culture-specific information to influence the comparison, and returns an integer that indicates the relationship of the two substrings to each other in the sort order. ### Method Not applicable (Static method) ### Parameters - **strA** (String) - The first string to compare. - **indexA** (Int32) - The starting position of the substring in the first string. - **strB** (String) - The second string to compare. - **indexB** (Int32) - The starting position of the substring in the second string. - **length** (Int32) - The number of characters to compare. - **culture** (CultureInfo) - An object that provides culture-specific comparison information. - **options** (CompareOptions) - Flags that specify whether to ignore case or the type of comparison. ### Request Example ```vba ' Assuming cultureInfo is a valid CultureInfo object and compareOptions is a valid CompareOptions value Dim result As Integer result = Strings.Compare("Apple", 1, "apricot", 1, 3, cultureInfo, compareOptions) ' Compares "ppl" and "pri" with specified options ' result depends on the cultureInfo and compareOptions ``` ### Response #### Success Response (Integer) - **Integer**: A value indicating the lexical relationship between the two substrings: - Less than 0: The substring of strA precedes the substring of strB. - 0: The substrings are equal. - Greater than 0: The substring of strA follows the substring of strB. ### Response Example ```vba -1 ``` ``` -------------------------------- ### Format(IFormatProvider, String, Object, Object) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Replaces the format items in a string with the string representation of two specified objects. A parameter supplies culture-specific formatting information. ```APIDOC ## Format(IFormatProvider, String, Object, Object) ### Description Replaces the format items in a string with the string representation of two specified objects. A parameter supplies culture-specific formatting information. ### Method Not applicable (function call) ### Parameters - **IFormatProvider** (IFormatProvider object) - An object that supplies culture-specific formatting information. - **String** (String) - A composite format string. - **Object** (Object) - The first object to format. - **Object** (Object) - The second object to format. ### Response - **String** - A new string that is identical to format or is a null reference if format is null, and whose elements are replaced by the string representation of the corresponding argument of this instance. ``` -------------------------------- ### Format(IFormatProvider, String, Object) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Replaces the format item or items in a specified string with the string representation of the corresponding object. A parameter supplies culture-specific formatting information. ```APIDOC ## Format(IFormatProvider, String, Object) ### Description Replaces the format item or items in a specified string with the string representation of the corresponding object. A parameter supplies culture-specific formatting information. ### Method Not applicable (function call) ### Parameters - **IFormatProvider** (IFormatProvider object) - An object that supplies culture-specific formatting information. - **String** (String) - A composite format string. - **Object** (Object) - The object to format. ### Response - **String** - A new string that is identical to format or is a null reference if format is null, and whose elements are replaced by the string representation of the corresponding argument of this instance. ### Request Example ```csharp string formattedString = String.Format(CultureInfo.CurrentCulture, "Hello, {0}!", "World"); ``` ### Response Example ```csharp "Hello, World!" ``` ``` -------------------------------- ### Case and whitespace utilities in VBA Source: https://context7.com/noah-severyn/vba-strings/llms.txt Provides consistent wrappers around VBA's native `ToUpper`, `ToLower`, `Trim`, `TrimEnd`, and `TrimLeft` functions. Use for standardizing string casing and removing whitespace. ```vb Strings.ToUpper("hello world") ' -> "HELLO WORLD" Strings.ToLower("HELLO WORLD") ' -> "hello world" Strings.Trim(" hello ") ' -> "hello" Strings.TrimEnd("hello ") ' -> "hello" Strings.TrimLeft(" hello") ' -> "hello" ``` -------------------------------- ### Format(String, Object, Object, Object) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Replaces the format items in a string with the string representation of three specified objects. ```APIDOC ## Format(String, Object, Object, Object) ### Description Replaces the format items in a string with the string representation of three specified objects. ### Method Not applicable (function call) ### Parameters - **String** (String) - A composite format string. - **Object** (Object) - The first object to format. - **Object** (Object) - The second object to format. - **Object** (Object) - The third object to format. ### Response - **String** - A new string that is identical to format or is a null reference if format is null, and whose elements are replaced by the string representation of the corresponding argument of this instance. ``` -------------------------------- ### Format(String, Object, Object) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Replaces the format items in a string with the string representation of two specified objects. ```APIDOC ## Format(String, Object, Object) ### Description Replaces the format items in a string with the string representation of two specified objects. ### Method Not applicable (function call) ### Parameters - **String** (String) - A composite format string. - **Object** (Object) - The first object to format. - **Object** (Object) - The second object to format. ### Response - **String** - A new string that is identical to format or is a null reference if format is null, and whose elements are replaced by the string representation of the corresponding argument of this instance. ``` -------------------------------- ### Retrieve content from StringBuilder Source: https://context7.com/noah-severyn/vba-strings/llms.txt Use Substring, SubstringBetween, and ToString to extract content. Substring retrieves a portion by index and length. SubstringBetween extracts text between delimiters. ToString flushes the entire buffer or a specified range to a String. ```vb Dim sb As New StringBuilder sb.Append "Hello, World!" ' Substring from index 7 for 5 chars sb.Substring(7, 5) ' -> "World" ``` ```vb ' Substring to end sb.Substring(7) ' -> "World!" ``` ```vb ' SubstringBetween markers sb.Clear: sb.Append "My Page" sb.SubstringBetween("", "") ' -> "My Page" ``` ```vb ' ToString full buffer sb.Clear: sb.Append "Final string" sb.ToString ' -> "Final string" ``` ```vb ' ToString a range (startIndex=6, count=6) sb.ToString(6, 6) ' -> "string" ``` -------------------------------- ### Compare(String, String, StringComparison) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Compares two specified String objects using the specified rules, and returns an integer that indicates their relative position in the sort order. ```APIDOC ## Compare(String, String, StringComparison) ### Description Compares two specified String objects using the specified rules, and returns an integer that indicates their relative position in the sort order. ### Method Not applicable (Static method) ### Parameters - **strA** (String) - The first string to compare. - **strB** (String) - The second string to compare. - **comparisonType** (StringComparison) - An enumeration that specifies the rules for the comparison. ### Request Example ```vba Dim result As Integer result = Strings.Compare("Apple", "apple", StringComparison.OrdinalIgnoreCase) ' result will be 0 because ordinal ignore case comparison is used ``` ### Response #### Success Response (Integer) - **Integer**: A value indicating the lexical relationship between the two strings: - Less than 0: strA precedes strB. - 0: strA and strB are equal. - Greater than 0: strA follows strB. ### Response Example ```vba 0 ``` ``` -------------------------------- ### Format(IFormatProvider, String, Object[]) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Replaces the format items in a string with the string representations of corresponding objects in a specified array. A parameter supplies culture-specific formatting information. ```APIDOC ## Format(IFormatProvider, String, Object[]) ### Description Replaces the format items in a string with the string representations of corresponding objects in a specified array. A parameter supplies culture-specific formatting information. ### Method Not applicable (function call) ### Parameters - **IFormatProvider** (IFormatProvider object) - An object that supplies culture-specific formatting information. - **String** (String) - A composite format string. - **Object[]** (Array of Objects) - An array of objects to format. ### Response - **String** - A new string that is identical to format or is a null reference if format is null, and whose elements are replaced by the string representation of the corresponding argument of this instance. ``` -------------------------------- ### Format(String, Object) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Replaces one or more format items in a string with the string representation of a specified object. ```APIDOC ## Format(String, Object) ### Description Replaces one or more format items in a string with the string representation of a specified object. ### Method Not applicable (function call) ### Parameters - **String** (String) - A composite format string. - **Object** (Object) - The object to format. ### Response - **String** - A new string that is identical to format or is a null reference if format is null, and whose elements are replaced by the string representation of the corresponding argument of this instance. ``` -------------------------------- ### ToUpper / ToLower / Trim / TrimEnd / TrimLeft Source: https://context7.com/noah-severyn/vba-strings/llms.txt Thin, consistent wrappers around VBA's native functions for case conversion and whitespace trimming. ```APIDOC ## Case and Whitespace Functions ### Description Provides consistent wrappers around VBA's native functions for case conversion and whitespace trimming. ### Methods - **ToUpper(text As String)**: Converts the string to uppercase. - **ToLower(text As String)**: Converts the string to lowercase. - **Trim(text As String)**: Removes leading and trailing whitespace. - **TrimEnd(text As String)**: Removes trailing whitespace. - **TrimLeft(text As String)**: Removes leading whitespace. ### Request Example ```vb Strings.ToUpper("hello world") Strings.ToLower("HELLO WORLD") Strings.Trim(" hello ") Strings.TrimEnd("hello ") Strings.TrimLeft(" hello") ``` ### Response Example ```vb "HELLO WORLD" "hello world" "hello" "hello" "hello" ``` ``` -------------------------------- ### Append(UInt64) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringBuilderFunctionTable.md Appends the string representation of a specified 64-bit unsigned integer to this instance. ```APIDOC ## Append(UInt64) ### Description Appends the string representation of a specified 64-bit unsigned integer to this instance. ### Method Append ### Parameters - **value** (UInt64) - The UInt64 value to append. ``` -------------------------------- ### Format Strings to Fixed Width with PadLeft and PadRight Source: https://context7.com/noah-severyn/vba-strings/llms.txt PadLeft and PadRight return new strings padded to a specified width with a character (default space). If the original string exceeds the width, it is returned unchanged. Padding with an empty string raises an error. ```vb ' PadLeft: right-align by padding on the left Strings.PadLeft("42", 6) ' -> " 42" Strings.PadLeft("42", 6, "0") ' -> "000042" Strings.PadLeft("TOOLONG", 3) ' -> "TOOLONG" (no truncation) ``` ```vb ' PadRight: left-align by padding on the right Strings.PadRight("Name", 10) ' -> "Name " Strings.PadRight("Name", 10, "-") ' -> "Name------" ``` ```vb ' Null or multi-char padding char raises error 9 On Error Resume Next Strings.PadLeft("x", 5, "") ' -> Err.Number = 9 On Error GoTo 0 ``` -------------------------------- ### Compare(String, Int32, String, Int32, Int32, StringComparison) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Compares substrings of two specified String objects using the specified rules, and returns an integer that indicates their relative position in the sort order. ```APIDOC ## Compare(String, Int32, String, Int32, Int32, StringComparison) ### Description Compares substrings of two specified String objects using the specified rules, and returns an integer that indicates their relative position in the sort order. ### Method Not applicable (Static method) ### Parameters - **strA** (String) - The first string to compare. - **indexA** (Int32) - The starting position of the substring in the first string. - **strB** (String) - The second string to compare. - **indexB** (Int32) - The starting position of the substring in the second string. - **length** (Int32) - The number of characters to compare. - **comparisonType** (StringComparison) - An enumeration that specifies the rules for the comparison. ### Request Example ```vba Dim result As Integer result = Strings.Compare("Apple", 1, "apricot", 1, 3, StringComparison.OrdinalIgnoreCase) ' Compares "ppl" and "pri" using ordinal ignore case rules ' result will be negative because 'p' < 'r' ``` ### Response #### Success Response (Integer) - **Integer**: A value indicating the lexical relationship between the two substrings: - Less than 0: The substring of strA precedes the substring of strB. - 0: The substrings are equal. - Greater than 0: The substring of strA follows the substring of strB. ### Response Example ```vba -1 ``` ``` -------------------------------- ### Combine Strings with Delimiters using Concat, Join, JoinBetween Source: https://context7.com/noah-severyn/vba-strings/llms.txt Use Concat to join values with a delimiter. Join concatenates arrays or Collections with a separator. JoinBetween joins a specified slice of an array. ```vb ' Concat: delimiter is first argument Dim result As String result = Strings.Concat(", ", "Alice", "Bob", "Carol") ' -> "Alice, Bob, Carol" ``` ```vb ' Join array Dim words() As String: words = Array("one", "two", "three") result = Strings.Join(" | ", words) ' -> "one | two | three" ``` ```vb ' Join a Collection Dim col As New Collection col.Add "red": col.Add "green": col.Add "blue" result = Strings.Join("-", col) ' -> "red-green-blue" ``` ```vb ' JoinBetween: join elements 1 through 2 (0-based start, count=2) result = Strings.JoinBetween(", ", words, 1, 2) ' -> "two, three" ``` -------------------------------- ### Compare(String, Int32, String, Int32, Int32, Boolean, CultureInfo) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Compares substrings of two specified String objects, ignoring or honoring their case and using culture-specific information to influence the comparison, and returns an integer that indicates their relative position in the sort order. ```APIDOC ## Compare(String, Int32, String, Int32, Int32, Boolean, CultureInfo) ### Description Compares substrings of two specified String objects, ignoring or honoring their case and using culture-specific information to influence the comparison, and returns an integer that indicates their relative position in the sort order. ### Method Not applicable (Static method) ### Parameters - **strA** (String) - The first string to compare. - **indexA** (Int32) - The starting position of the substring in the first string. - **strB** (String) - The second string to compare. - **indexB** (Int32) - The starting position of the substring in the second string. - **length** (Int32) - The number of characters to compare. - **ignoreCase** (Boolean) - True to ignore case during comparison; otherwise, false. - **culture** (CultureInfo) - An object that provides culture-specific comparison information. ### Request Example ```vba ' Assuming cultureInfo is a valid CultureInfo object Dim result As Integer result = Strings.Compare("Apple", 1, "apricot", 1, 3, True, cultureInfo) ' Compares "ppl" and "pri", ignoring case and using culture info ' result depends on the cultureInfo object ``` ### Response #### Success Response (Integer) - **Integer**: A value indicating the lexical relationship between the two substrings: - Less than 0: The substring of strA precedes the substring of strB. - 0: The substrings are equal. - Greater than 0: The substring of strA follows the substring of strB. ### Response Example ```vba -1 ``` ``` -------------------------------- ### Append(String) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringBuilderFunctionTable.md Appends a copy of the specified string to this instance. ```APIDOC ## Append(String) ### Description Appends a copy of the specified string to this instance. ### Method Append ### Parameters - **value** (String) - The string to append. ``` -------------------------------- ### PadLeft Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Returns a new string that right-aligns the characters in this instance by padding them with spaces on the left, for a specified total length. ```APIDOC ## PadLeft(Int32) ### Description Returns a new string that right-aligns the characters in this instance by padding them with spaces on the left, for a specified total length. ### Parameters - **totalLength** (Int32) - The number of characters in the resulting string, equal to the number of input characters plus any additional padding characters. ### Returns A new string that right-aligns the current string by padding it with spaces on the left, or returns the original string if the length of the original string is greater than or equal to totalLength. ``` -------------------------------- ### Compare(String, String, Boolean, CultureInfo) Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Compares two specified String objects, ignoring or honoring their case, and using culture-specific information to influence the comparison, and returns an integer that indicates their relative position in the sort order. ```APIDOC ## Compare(String, String, Boolean, CultureInfo) ### Description Compares two specified String objects, ignoring or honoring their case, and using culture-specific information to influence the comparison, and returns an integer that indicates their relative position in the sort order. ### Method Not applicable (Static method) ### Parameters - **strA** (String) - The first string to compare. - **strB** (String) - The second string to compare. - **ignoreCase** (Boolean) - True to ignore case during comparison; otherwise, false. - **culture** (CultureInfo) - An object that provides culture-specific comparison information. ### Request Example ```vba ' Assuming cultureInfo is a valid CultureInfo object Dim result As Integer result = Strings.Compare("Apple", "apple", True, cultureInfo) ' result depends on the cultureInfo object ``` ### Response #### Success Response (Integer) - **Integer**: A value indicating the lexical relationship between the two strings: - Less than 0: strA precedes strB. - 0: strA and strB are equal. - Greater than 0: strA follows strB. ### Response Example ```vba 0 ``` ``` -------------------------------- ### Append content to StringBuilder Source: https://context7.com/noah-severyn/vba-strings/llms.txt Use Append, AppendMultiple, AppendJoin, and AppendLine for adding content to the StringBuilder buffer. AppendMultiple accepts varargs and arrays, while AppendJoin appends array elements with a separator. AppendLine adds a newline character. ```vb Dim sb As New StringBuilder sb.Append "Hello" sb.Append ", " sb.Append "World" sb.ToString ' -> "Hello, World" ``` ```vb ' AppendMultiple: varargs, arrays sb.Clear sb.AppendMultiple "one", "two", "three" sb.ToString ' -> "onetwothree" ``` ```vb ' AppendJoin: elements with separator Dim parts() As String: parts = Array("alpha", "beta", "gamma") sb.Clear sb.AppendJoin "|", parts sb.ToString ' -> "alpha|beta|gamma" ``` ```vb ' AppendLine: adds newline then optional text sb.Clear sb.AppendLine "First line" sb.AppendLine "Second line" sb.AppendLine ' blank line sb.AppendLine "Third line" sb.ToString ' -> "First line" & vbNewLine & "Second line" & vbNewLine & vbNewLine & "Third line" ``` -------------------------------- ### PadLeft Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified Unicode character, for a specified total length. ```APIDOC ## PadLeft(Int32, Char) ### Description Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified Unicode character, for a specified total length. ### Parameters #### Path Parameters - **length** (Int32) - Required - The total length of the new string. - **padChar** (Char) - Required - The Unicode character to use for padding. ### Method [Implicitly a method of a string object] ### Endpoint [N/A - SDK/Library Function] ``` ```APIDOC ## PadLeft(Int32) ### Description Returns a new string that left-aligns the characters in this string by padding them with spaces on the right, for a specified total length. ### Parameters #### Path Parameters - **length** (Int32) - Required - The total length of the new string. ### Method [Implicitly a method of a string object] ### Endpoint [N/A - SDK/Library Function] ``` -------------------------------- ### PadRight Source: https://github.com/noah-severyn/vba-strings/blob/main/docs/StringsFunctionTable.md Returns a new string that left-aligns the characters in this string by padding them on the right with a specified Unicode character, for a specified total length. ```APIDOC ## PadRight(Int32, Char) ### Description Returns a new string that left-aligns the characters in this string by padding them on the right with a specified Unicode character, for a specified total length. ### Parameters #### Path Parameters - **length** (Int32) - Required - The total length of the new string. - **padChar** (Char) - Required - The Unicode character to use for padding. ### Method [Implicitly a method of a string object] ### Endpoint [N/A - SDK/Library Function] ``` -------------------------------- ### Concat / Join / JoinBetween Source: https://context7.com/noah-severyn/vba-strings/llms.txt Functions to combine strings with delimiters. `Concat` joins individual arguments, `Join` concatenates array or Collection elements, and `JoinBetween` joins a specified slice of an array. ```APIDOC ## Concat / Join / JoinBetween — Combine with delimiters `Concat` joins values with a delimiter. `Join` concatenates an array or `Collection` with a separator. `JoinBetween` joins a slice of an array starting at `startIndex` for `count` elements. ```vb ' Concat: delimiter is first argument Dim result As String result = Strings.Concat(", ", "Alice", "Bob", "Carol") ' -> "Alice, Bob, Carol" ' Join array Dim words() As String: words = Array("one", "two", "three") result = Strings.Join(" | ", words) ' -> "one | two | three" ' Join a Collection Dim col As New Collection col.Add "red": col.Add "green": col.Add "blue" result = Strings.Join("-", col) ' -> "red-green-blue" ' JoinBetween: join elements 1 through 2 (0-based start, count=2) result = Strings.JoinBetween(", ", words, 1, 2) ' -> "two, three" ``` ```