StrConv Function

Returns a string converted as specified.

Public Shared Function StrConv( _
   ByVal str As String, _
   ByVal Conversion As Microsoft.VisualBasic.VbStrConv, _
   Optional ByVal LocaleID As Integer, 
) As String


  • str
    Required. String expression to be converted.

  • Conversion
    Required. VbStrConv Enumeration member. The enumeration value specifying the type of conversion to perform.

  • LocaleID
    Optional. The LocaleID value, if different from the application's current culture value. For more information about locale IDs and culture information, see CultureInfo. (The application's current culture value is the default.)


The Conversion argument settings are:

Enumeration member



Performs no conversion


Uses linguistic rules for casing, rather than File System (default). Valid with VbStrConv.UpperCase and VbStrConv.LowerCase only.


Converts the string to uppercase characters.


Converts the string to lowercase characters.


Converts the first letter of every word in string to uppercase.


Converts narrow (half-width) characters in the string to wide (full-width) characters.


Converts wide (full-width) characters in the string to narrow (half-width) characters.


Converts Hiragana characters in the string to Katakana characters.


Converts Katakana characters in the string to Hiragana characters.


Converts Traditional Chinese characters to Simplified Chinese.


Converts Simplified Chinese characters to Traditional Chinese.

*   Applies to Asian locales.

**   Applies to Japan only.


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.


Exception type

Error number




Unsupported LocaleID, Conversion < 0 or > 2048, or unsupported conversion for specified locale.

See the "Error number" column if you are upgrading Visual Basic 6.0 applications that use unstructured error handling. (You can compare the error number against the Number Property (Err Object).) However, when possible, you should consider replacing such error control with Structured Exception Handling Overview for Visual Basic.


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.

Security noteSecurity Note:

If your application makes security decisions based on the result of a comparison or case-change operation, then the operation should use the String.Compare method, and pass Ordinal or OrdinalIgnoreCase for the comparisonType argument. For more information, see How Culture Affects Strings in Visual Basic.


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)

Smart Device Developer Notes

This function is not supported.




Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

See Also


String Manipulation Summary

Chr, ChrW Functions

String Data Type (Visual Basic)

Type Conversion Functions