Chrw in C # encoding conversion

Source: Internet
Author: User

''''''''''''''''''''''''''''''''
''
'& #45236; & #44172; & #47196; & #20449; & #29992;
'& #38989; & #24230; & #26410; & #32080; & #26463;
& Amp; #25237; & amp; #27880;

''Encoding into Chinese.
''
''2006-12-22
''
''Bw wisdom
''
''Qq: 214958266
''
''''''''''''''''''''''''''''''''

Public class code

Public Function asciitostring (byval asciilist () as integer) as string
Dim I as integer
Dim STR as string
For I = 0 to asciilist. Length-1
STR + = chrw (asciilist (I ))
Next
Return Str
End Function
Public Function stringtoascii (byval [String] as string) as INTEGER ()
Dim asciilist ([String]. Length) as integer
Dim I as integer
For I = 0 to [String]. Length-1
Asciilist (I) = ASCW (mid ([String], I + 1, 1 ))
Next
Return asciilist
End Function

Public Function chrwchr (byval asciicode as integer) as string
Return chrw (asciicode)
End Function
Public Function ascwint (byval [String] as string) as integer
Return ASCW ([String])
End Function
Public Function Test () as string
Dim I (12) as integer
'& #45236; & #44172; & #47196; & #20449; & #29992;
'& #38989; & #24230; & #26410; & #32080; & #26463;
& Amp; #25237; & amp; #27880;

I (0) = 45236
I (1) = 44172
I (2) = 47196
I (3) = 20449
I (4) = 29992
I (5) = 38989
I (6) = 24230
I (7) = 26410
I (8) = 32080
I (9) = 26463
I (9) = 25237
I (9) = 27880
Return asciitostring (I) ''the test () function will return:" your credit limit is not final. Note "this string

 

End Function
End Class
 

 

 

If it is in C #, use the following:

 

Private string decode (string SRC)
{

// The parameter value SRC is: & #38989; & #24230; & #26410; & #32080; & #26463; & #25237; & #27880;

// The result is decoded as follows: for example, a bet is not completed due to the degree of attention.
Stringbuilder sb = new stringbuilder ();
Stringwriter Sw = new stringwriter (SB );
Httputility. htmldecode (SRC, SW );
Sw. Close ();
Return sb. tostring ();
}

 

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.