[VBA] character conversion code: full-width to half-width, hirakana to Katakana, uppercase letters

Source: Internet
Author: User
, Strconv Function


Returns the variant (string) converted by the specified type ).

Syntax

Strconv (string, conversion, lcid)

The syntax of the strconv function includes the following naming parameters:

Description
String required parameter. The string expression to be converted.
Required conversion parameters. Integer. The sum of its values determines the type of conversion.
Lcid is optional. If it is different from the system localeid, It is localeid (the default value is the system localeid .)


Set Value

The conversion parameter is set:

Constant Value description
Vbuppercase 1 converts string text to uppercase.
Vblowercase 2 converts string text to lowercase.
Vbpropercase 3 converts the start letter of each character in the string into uppercase letters.
Vbwide * 4 * converts single-byte characters in a string into double-byte characters.
Vbnarrow * 8 * converts double-byte characters in a string into single-byte characters.
Vbkatakana ** 16 ** converts a hirakana character in a string into a katakana character.

Vbhiragana ** 32 ** converts a katakana character in a string into a hirakana character.
Vbunicode 64 converts a string to Unicode based on the system's default code page.
Vbfromunicode 128 converts a string from Unicode to the default code page of the system.



* Apply to the far east country.

** Only applicable to Japan.

Note that these constants are specified by VBA. They can be used in programs to replace real values. Most of them can be combined, such as vbuppercase + vbwide. mutex constants cannot be combined, such as vbunicode + vbfromunicode. When the constant vbwide, vbnarrow, vbkatakana, and vbhiragana are used in unsuitable countries, a runtime error occurs.

Below are some common valid delimiters: NULL (CHR $ (0), horizontal tab (CHR $ (9), line feed (CHR $(10 )), vertical tab (CHR $ (11), feed (CHR $ (12), press enter (CHR $ (13), blank (sbcs) (CHR $(32 )). In DBCS, the actual blank value varies with the country/region.

Description

When converting an ANSI byte array to a string, you should use the strconv function. When you convert an array in unicode format, use the value assignment statement.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.