C#中的等效代码是什么? [英] What is its equivalent code in C#?

查看:77
本文介绍了C#中的等效代码是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C#中等效的代码是什么

What is the equivalent code in C# for

Dim Buffer As Variant    
ss=StrConv(Buffer, vbUnicode)



这是我的字符串:



This is my string:

string Buffer = "*''q*''q*''q*''q*''q*''q*''q*''q\r''pP79 r\" \aF0D \aq4''F9''
F7\a.s\nWp \aq \a9JE79mw9f \aqFGrremGs\nWp \aq \aq4q \aq 
\aq \aq2Wp\n \aq \aq5\aq\f \aq \aq \aq1Wp\n \aq \aq4qc 
\aq \aq D57\\p\n \aq \aq5\aq4\aq \aq \aq3\a\\p\n \aq 
\aq4q \aq \aq \\c7Wp\n\r''p \aq \aq4q \aq \aq b6W\\p\n 
\aq \aq5\aq \aq \aq \aq3Wp\n \aq \aq5\aqF \aq \aq 
\\F3Wp\n \aq \aq4q\r \aq \aq \aqc3Wp\n \aq \aq5\aqF \aq 
\aq \aqF7Wp\n";


现在我要普通文本.
请..........帮助我


Now i want normal text from it.
Pls.......... help me

推荐答案

等效的C#取决于您的缓冲区是什么.如果它已经是类似于string Buffer = "<bunch of characters>";的字符串,则无需执行任何操作.它已经是一个unicode字符串.如果是字节数组,请使用 System.Text.Encoding [ ^ ]和呼叫 GetString(buffer) [ Convert() [
The equivalent C# depends a bit on what your buffer is. If it''s already a string like your string Buffer = "<bunch of characters>";, you don''t have to do anything. It is already a unicode string. If it''s a byte array, use one of the encoders in System.Text.Encoding[^] and call GetString(buffer)[^]. You can also call Convert()[^] first if you know the bytes are not in the encoding you need.

I''m not sure what you mean by "normal text". The string you show is as good as you are going to get due to the unprintable characters it contains.


这篇关于C#中的等效代码是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆