StrConv$ Function

Syntax

StrConv[$](Str, Conv)

Group

String

Description

Converts the string.

Parameters

Parameters Description
Str Converts this string value. If this value is Null, Null is returned.
Conv Indicates the type of conversion. See conversion table below.

 

Conv Value Effect
vbUpperCase 1 Converts a String to upper case.
vbLowerCase 2 Converts a String to lower case.
vbProperCase 3 Converts a String to proper case. (Not supported.)
vbWide 4 Converts a String to wide. (Only supported for eastern locations.)
vbNarrow 8 Converts a String to narrow. (Only supported for eastern locations.)
vbKatakana 16 Converts a String to Katakana. (Only supported for Japanese locations.)
vbHiragana 32 Converts a String to Hiragana. (Only supported for Japanese locations.)
vbUnicode or vbFromANSIBytes 64 Converts an ANSI (locale dependent) byte array to a Unicode string.
vbFromANSI 4160 Converts an ANSI (locale dependent) string to a Unicode string.
vbFromUnicode or vbANSIBytes 128 Converts from Unicode to an ANSI (locale dependent) byte array.
vbANSI 4224 Converts from Unicode to an ANSI (locale dependent) string.
vbUTF8 4352 Converts a Unicode string to a UTF-8 string.
vbUTF8Bytes 256 Converts a Unicode string to a UTF-8 byte array.
vbFromUTF8 4608 Converts a UTF-8 string to a Unicode string.
vbFromUTF8Bytes 512 Converts a UTF-8 byte array to a Unicode string.
vbToBytes 1024 Converts a String to a byte array containing the low byte of each char.
vbFromBytes 2048 Converts a byte array to a String by setting the low byte of each char.

Conversion rules

If multiple conversions are specified, the conversions occur in the following order:

  • vbFromBytes, vbUnicode, vbFromANSI, vbFromANSIBytes, vbFromUTF8 or vbFromUTF8Bytes (choose one, optional)
  • vbUpperCase, vbLowerCase, vbWide, vbNarrow, vbKatakana or vbHiragana (choose one or more, optional)
  • vbToBytes, vbFromUnicode, vbANSI, vbANSIBytes, vbUTF8 or vbUTF8Bytes (choose one, optional)

Example


Sub Main
    Dim B(1 To 3) As Byte
    B(1) = 65
    B(2) = 66
    B(3) = 67
    Debug.Print StrConv$(B,vbUnicode) '"ABC"
End Sub

See also

LCase$( ), StrComp( ), UCase$( )