StrConv Function |
Microsoft.VisualBasic.Strings
StrConv( str, conversion [, localeID ])
The string expression to convert
One of the constants listed in Section
The locale identifier to use for the conversion
A String converted according to conversion
Performs special conversions on a string
The following intrinsic conversion constants specify the type of conversion to perform:
Constant | Converts... |
---|---|
VbStrConv.UpperCase | The entire string to uppercase. |
VbStrConv.LowerCase | The entire string to lowercase. |
VbStrConv.ProperCase | The first letter of every word in str to an uppercase character. |
VbStrConv.Wide | Narrow (single-byte) characters in str to wide (double-byte) characters. |
VbStrConv.Narrow | Wide (double-byte) characters in str to narrow (single-byte) characters. |
VbStrConv.Katakana | Hiragana characters in str to Katakana characters. |
VbStrConv.Hiragana | Katakana characters in str to Hiragana characters. |
VbStrConv.LinguisticCasing | Uses linguistic rules for casing . Can be used only with UpperCase and LowerCase . |
VbStrConv.None | Performs no conversion on str . |
VbStrConv.SimplifiedChinese | Traditional Chinese characters in str to Simplified Chinese. |
VbStrConv.TraditionalChinese | Simplified Chinese characters in str to Traditional Chinese. |
You can combine some of these constants by adding them together or using a logical OR . For example:
VbStrConv.UpperCase + VbStrConv.Wide
The only restriction is that the constants must be mutually exclusive. For example, specifying the value:
VbStrConv.UpperCase Or VbStrConv.ProperCase ' Error
produces an error.
VbStrConv.Katakana and VbStrConv.Hiragana only apply to locales in Japanese. Use of these constants on systems using other locales generates runtime error 5, "Invalid procedure call or argument."
VbStrConv.Wide and VbStrConv.Narrow only apply to locales in the Far East. Use of these constants on systems using other locales will generate a runtime error.
When determining the start of a new word to convert to proper case, StrConv recognizes the following characters as word separators:
Null Chr$(0)
Horizontal Tab Chr$(9)
Line-feed Chr$(10)
Vertical Tab Chr$(11)
Form Feed Chr$(12)
Carriage Return Chr$(13)
Space Chr$(32)
If you convert to proper case, StrConv converts the first letter of each word to uppercase regardless of whether that word is significant. Hence, "this is the time" becomes "This Is The Time," even though "the" ordinarily would not be capitalized.
Two conversion values supported by VB 6, VbUnicode and VbFromUnicode , have no equivalent in the VbStrConv enumeration. As a result, the function can no longer be used to convert ASCII to Unicode or Unicode to ASCII.
StrComp Function, StrDup Function, StrReverse Function