Επεξεργασία

Κοινή χρήση μέσω


Strings.StrReverse(String) Method

Definition

Returns a string in which the order of the text elements in the specified string is reversed.

public:
 static System::String ^ StrReverse(System::String ^ Expression);
public static string StrReverse (string? Expression);
public static string StrReverse (string Expression);
static member StrReverse : string -> string
Public Function StrReverse (Expression As String) As String

Parameters

Expression
String

Required. String expression whose text elements are to be reversed. If Expression is a zero-length string (""), a zero-length string is returned.

Returns

A string in which the order of the text elements in the specified string is reversed.

Examples

Dim testString As String = "ABCDEFG"
' Returns "GFEDCBA".
Dim revString As String = StrReverse(testString)

Remarks

The StrReverse function returns a string that contains the same text elements as Expression, but in the opposite order. A text element as a unit of text that is displayed as a single character, that is, a grapheme.

For example, consider the string "re\u0301sume\u0301", where '\u0301' is the code point U+0301 COMBINING ACUTE ACCENT. When displayed to the user, this string appears as the word résumé with the accents correctly placed over the 'e' characters. If the word résumé was reversed character by character, the resulting string would be ́emuśer, with one of the accents over the wrong character. Instead, StrReverse divides the input string into its individual text elements, keeping each text element intact but swapping the positions of each text element within the resulting string.

For more information about how .NET divides a string instance into text elements, see the Remarks section for the StringInfo class.

Applies to

See also