CorString

CorString


Provides static functions to format and manipulate string values.


Public:

Types:

NameDescription
 CompareOptions Defines the string comparison options to use with certain implementations of the CorString.Compare and CorString.Equals methods.

This enumeration allows a bitwise combination of its member values.

 
 StringComparison Specifies the culture, case, and sort rules to be used with certain implementations of the CorString.Compare and CorString.Equals methods.  
 StringSplitOptions Specifies whether CorString.Split method include or omit empty substrings from the return value.  

Methods:

NameDescription
 CharAt Returns character value from a string at the specified index.  
 Compare Compares two specified String objects using the specified rules, and returns an integer that indicates their relative position in the sort order.  
 CompareCultural 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.  
 CompareCulturalEx 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.  
 CompareEx Compares substrings of two specified String objects using the specified rules, and returns an integer that indicates their relative position in the sort order.  
 CompareOrdinal Compares two specified String objects by evaluating the numeric values of the corresponding Char objects in each string.  
 CompareOrdinalEx Compares substrings of two specified String objects by evaluating the numeric values of the corresponding Char objects in each substring.  
 CopyTo Copies a specified number of characters from a specified position in a string to a specified position in an array of Unicode characters.  
 EndsWith Determines whether the end of a string matches the specified string when compared using the specified comparison option.  
 EndsWithEx Determines whether the end of this string instance matches the specified string when compared using the specified culture.  
 Equals Determines whether two specified Strings have the same value.  
 Format Replaces the format item in a specified string with the string representation of a corresponding value in a specified array.  
 FormatArray Replaces the format item in a specified string with the string representation of a corresponding value in a specified array.  
 FormatArrayEx Replaces the format item in a specified string with the string representation of a corresponding object in a specified array. A specified parameter supplies culture-specific formatting information.  
 FormatEx Replaces the format item in a specified string with the string representation of a corresponding object in a specified array. A specified parameter supplies culture-specific formatting information.  
 IndexOfAny Reports the zero-based index of the first occurrence in s 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.  
 Insert Returns a new string in which a specified string is inserted at a specified index position in s.  
 IsNull Returns if the string is null.  
 IsNullOrWhiteSpace Returns if the string is null, empty or contains only white-space characters.  
 Join Concatenates the specified elements of an array or collection, using the specified separator between each element.  
 LastIndexOfAny Reports the zero-based index of the first occurrence in s 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.  
 PadLeft 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.  
 PadRight 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.  
 Remove Returns a new string in which a specified number of characters beginning at a specified position have been deleted.  
 Split Splits a string into a maximum number of substrings based on the strings or characters in an array. You can specify whether the substrings include empty array elements.  
 StartsWith Determines whether the beginning of a string matches the specified string when compared using the specified comparison option.  
 StartsWithEx Determines whether the beginning of this string instance matches the specified string when compared using the specified culture.  
 ToCharArray Creates and array of chars (Integers) from the specified string.  
 Trim Removes all leading and trailing occurrences of a set of characters specified in an array from the s parameter.  
 TrimEnd Removes all trailing occurrences of a set of characters specified in an array from the s parameter.  
 TrimStart Removes all leading occurrences of a set of characters specified in an array from the s parameter.  

Remarks

This class cannot be directly instantiated. The methods are accessed through the class name itself.

Examples

The following example shows how to call various methods on the CorString class.

Public Sub Main()
    Const Sentance As String = "This string consists of a single short sentence."
    
    Dim Words() As String
    Dim Word As Variant
    
    Words = CorString.Split(Sentance, " ")
    
    For Each Word In Words
        Debug.Print CorString.Format("'{0}'", Word)
    Next
End Sub

' This code produces the following output.
'
'    'This'
'    'string'
'    'consists'
'    'of'
'    'a'
'    'single'
'    'short'
'    'sentence.'

See Also

Project CorLib Overview

Class CorString Overview