StrConv$ Function

Syntax

StrConv[$](Str, Conv)

Group

String

Description

Convert the string.

Parameters

Parameters Description
Str Convert this string value. If this value is Null then Null is returned.
Conv This numeric value indicates the type of conversion. See conversion table below.

 

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