-7
测试用例:字符串编码程序
banagalore (of type String)
预期输出:
{30,20,21,92,20,80,32,31,02}
我已经转换他们使用C#为ASCII,现在我不能够将它们转换成序列,请建议一些想法。
代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Program p = new Program();
Console.WriteLine("Enter The String ");
string str = Console.ReadLine();
byte[] b = Encoding.ASCII.GetBytes(str);
foreach (var item in b)
{
Console.WriteLine(item);
}
}
}
}
ASCII?你能详细说一下吗? – 2014-10-20 14:44:20
只需要将字符串转换为该序列,我有上面提到的测试用例之一。我认为逻辑必须将字符串中的每个字符转换为ASCII值,然后找出必须做什么,我陷入困境之后 – Vinodh 2014-10-20 14:50:32
SO并不是真正解决难题的地方 - 当找到什么操作将“banagalore”转换为“ {30,20,21,92,20,80,32,31,02}“可能有趣,但不适合SO。 (即,在我知道的任何编码中,它显然不是字符代码) – 2014-10-20 14:50:47