Returns a string converted as specified.
Namespace:
Microsoft.VisualBasic
Assembly:
Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
Visual Basic (Declaration)
Public Shared Function StrConv ( _
str As String, _
Conversion As VbStrConv, _
LocaleID As Integer _
) As String
Dim str As String
Dim Conversion As VbStrConv
Dim LocaleID As Integer
Dim returnValue As String
returnValue = Strings.StrConv(str, Conversion, _
LocaleID)
public static string StrConv(
string str,
VbStrConv Conversion,
int LocaleID
)
public:
static String^ StrConv(
String^ str,
VbStrConv Conversion,
int LocaleID
)
public static function StrConv(
str : String,
Conversion : VbStrConv,
LocaleID : int
) : String
For more detailed information, see the Visual Basic topic StrConv Function.
The constants VbStrConv.Wide, VbStrConv.Narrow, VbStrConv.SimplifiedChinese, VbStrConv.TraditionalChinese, VbStrConv.Katakana, and VbStrConv.Hiragana can cause run-time errors when used in locales where they do not apply, but not always: the constants VbStrConv.Katakana and VbStrConv.Hiragana can be used in a non-Japanese system with the Japanese Language Pack installed. In addition, use of the constants VbStrConv.Wide and VbStrConv.Narrow is supported on any system with an East Asian language installed.
This function uses the application's culture information when manipulating the string so that the case changes are appropriate for the locale in which the application is being used.
The Conversion argument settings are:
Enumeration member | Description |
|---|
VbStrConv.None
| Performs no conversion |
VbStrConv.LinguisticCasing
| Uses linguistic rules for casing, rather than File System (default). Valid with VbStrConv.UpperCase and VbStrConv.LowerCase only. |
VbStrConv.UpperCase
| Converts the string to uppercase characters. |
VbStrConv.LowerCase
| Converts the string to lowercase characters. |
VbStrConv.ProperCase
| Converts the first letter of every word in string to uppercase. |
VbStrConv.Wide
*
| Converts narrow (half-width) characters in the string to wide (full-width) characters. |
VbStrConv.Narrow
*
| Converts wide (full-width) characters in the string to narrow (half-width) characters. |
VbStrConv.Katakana
**
| Converts Hiragana characters in the string to Katakana characters. |
VbStrConv.Hiragana
**
| Converts Katakana characters in the string to Hiragana characters. |
VbStrConv.SimplifiedChinese
*
| Converts Traditional Chinese characters to Simplified Chinese. |
VbStrConv.TraditionalChinese
*
| Converts Simplified Chinese characters to Traditional Chinese. |
* Applies to Asian locales.
** Applies to Japan only.
Note: |
|---|
These constants are specified in the .NET Framework common language runtime. As a result, they can be used anywhere in your code in place of the actual values. Most can be combined (for example, UpperCase + Wide), except when they are mutually exclusive (for example, VbStrConv.Wide + VbStrConv.Narrow). |
The following are valid word separators for proper casing: Null (Chr$(0)), horizontal tab (Chr$(9)), line feed (Chr$(10)), vertical tab (Chr$(11)), form feed (Chr$(12)), carriage return (Chr$(13)), space (single-byte character set) (Chr$(32)). The actual value for a space, which can be full or half width, varies by country/region for East Asian cultures.
This example converts text into all lowercase letters.
Dim sText As String = "Hello World"
' Returns "hello world".
Dim sNewText As String = StrConv(sText, VbStrConv.LowerCase)
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Reference
Other Resources