帮转换一个C#代码 - .NET技术 / VB.NET
帮转成VB的,先谢了
C# code:
public string UtoGB(string str)
{
string[] ss = str.Split(''%'');
byte[] bs = new Byte[ss.Length - 1];
for (int i = 1; i < ss.Length; i++)
{
bs[i - 1] = Convert.ToByte(Convert2Hex(ss[i])); //ss[0]为空串
}
char[] chrs = System.Text.Encoding.GetEncoding("GB2312").GetChars(bs);
string s = "";
for (int i = 0; i < chrs.Length; i++)
{
s += chrs[i].ToString();
}
return s;
}
不熟悉VB
VB.NET code:
public string UtoGB(string str)
{
string[] ss = str.Split(''%'');
byte[] bs = new Byte[ss.Length - 1];
for (int i = 1; i < ss.Length; i++)
{
bs[i - 1] = Convert.ToByte(Convert2Hex(ss[i])); //ss[0]为空串
}
char[] chrs = System.Text.Encoding.GetEncoding("GB2312").GetChars(bs);
string s = "";
for (int i = 0; i < chrs.Length; i++)
{
s += chrs[i].ToString();
}
相关问答:
我想把word另存为xml之后,用vb读取这个xml的内容,请问如何实现?
dim f as integer
dim b() as byte
dim s as string
dim L as long
f=freefile()
open "abc.xml" for binary access read as #f
......
我有一个类似的xml的 string,想通过遍历怎么个xml 输出我想要的element的值
xml 为:
<Discover xmlns="urn:schemas-microsoft-com:xml-analysis">
<RequestType>DISCOVER_XML_ME ......
怎么把已知的数据保存成xml文件,现在已知的数据是
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o=& ......
xmlDoc1.loadXML(h)总是返回false,为什么?谢谢帮忙回答一下
h是什么呢。。。。。。。。。
h是xml格式的字符串
你是想打开。XML格式的文件吧?
我是把h放在xmlDoc1里,用xmlDoc1.loadXML(h),然后取xmlDo ......
谁能帮我把下面这些代码改成VB形式的,多谢了,急用~~
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
float objfx(float x[]);
void constraint(float x[],float g ......