StrConv Function


StrConv Function

Class

Microsoft.VisualBasic.Strings

Syntax

     Dim result As String = StrConv(str, conversion[, localeID]) 


str (required; String)

The string expression to convert.


conversion (required; VbStrConv enumeration)

The type of conversion to perform. One or more of the following Microsoft.VisualBasic.VbStrConv enumeration values (multiple constants can be Or'd together):

Value

Description

UpperCase

Converts the entire string to uppercase.

LowerCase

Converts the entire string to lowercase.

ProperCase

Capitalizes only the first letter of each word.

Wide

Widens supported characters from their narrow equivalents.

Narrow

Narrows supported characters from their wide equivalents.

Katakana

Converts hiragana characters to katakana.

Hiragana

Converts katakana characters to hiragana.

LinguisticCasing

Uses linguistic rules for casing. To use this, Or this constant together with UpperCase or LowerCase.

None

Performs no conversion; returns the original string.

SimplifiedChinese

Converts traditional Chinese characters to simplified Chinese.

traditionalChinese

Converts simplified Chinese characters to traditional Chinese.



localeID (optional; Integer)

The locale identifier to use for the conversion.

Description

The StrConv function performs a special character conversion on str, and returns the converted version.

Usage at a Glance

  • You can combine multiple VbStrConv constants together by adding or Or'ing them together, as long as they are not mutually exclusive in meaning. For instance, the following pair is valid:

         VbStrConv.UpperCase Or VbStrConv.Wide 

    but the following statement is not:

         VbStrConv.UpperCase Or VbStrConv.LowerCase 

  • VbStrConv.Katakana and VbStrConv.Hiragana can only be used with Japanese locales.

  • VbStrConv.Wide and VbStrConv.Narrow can only be used with Asian locales.

  • When determining the start of a new word to convert to proper case, StrConv recognizes the following characters as word separators (with their decimal ASCII values in parentheses): Null (0), Horizontal Tab (9), Line Feed (10), Vertical Tab (11), Form Feed (12), Carriage Return (13), and Space (32).

  • If you convert to proper case, StrConv converts the first letter of each word to uppercase, regardless of whether that word is significant. The string "this is the time" becomes "This Is The Time," even though "the" ordinarily would not be capitalized.

Version Differences

Two conversion values supported in VB 6, vbUnicode and vbFromUnicode, have no equivalent in .NET. The function can no longer be used to convert ASCII to Unicode or Unicode to ASCII.

See Also

StrComp Function, StrDup Function, StrReverse Function




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net