有一string A=“PN”,如何转成string B“80;78;” ,又如何换回来。P的ASCII 十进制借为80字符串转换
解决方案 »
- 帮忙看看下面这个C#程序
- 如何控制鼠标,移动并悬停到某个控件上方?
- Reporting Service无法连接问题(高分请教)
- 用c#写的xml文件无法解析,是为什么呢?
- VB转C#
- 怎么把函数地址转换成委托调用的函数?
- 精通C#程序的人是不是不需要文档和百度的情况能写程序的人?
- 存储过程输出参数
- 求助:SqlDataReader问题。为何我用READ()读取的时候总是说:“阅读器关闭时 Read 的尝试无效。”
- 我写了一个类,调用时为什么会返回这个值,望大家看看这是什么原因
- VS2010用C#访问SQL数据库,想实现用listbox1控件显示表1的某列,listbox2控件显示表2的某列,代码如下
- C# WinCE平台下怎样实现button按钮的mouseup mousedown事件
string B = String.Join(";", A.ToCharArray().Select(x => (int)x).ToArray());
string C = String.Join("", B.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries).Select(x => (char)Convert.ToInt32(x)).ToArray());
编译完,显示The best overloaded method match for 'string.Join(string, string[])' has some invalid arguments,
还有Argument '2': cannot convert from 'string' to 'string[]'
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string s = "PN";
string B = string.Join(";", s.Select(x => Convert.ToString((int)x)).ToArray()) + ";";
Console.WriteLine(B);
string A = new string(B.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries).Select(x => (char)int.Parse(x)).ToArray());
Console.WriteLine(A);
}
}
}80;78;
PN
Press any key to continue . . .