字符串如何转化为ASCII码?

shark2004 2004-08-23 10:58:18
字符串(或字符)如何转化为ASCII码?转化后如何显示ASCII码??又如何将转化后的ASCII码转化回字符串(或字符)?
...全文
174 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
brando_beat 2005-09-06
  • 打赏
  • 举报
回复
Class ASCIIEncodingExample

Public Shared Sub Main()
Dim bytes() As Byte = { _
65, 83, 67, 73, 73, 32, 69, _
110, 99, 111, 100, 105, 110, 103, _
32, 69, 120, 97, 109, 112, 108, 101}

Dim ascii As New ASCIIEncoding()
Dim decoded As String = ascii.GetString(bytes, 6, 8)
Console.WriteLine(decoded)
End Sub
End Class
jamex 2005-09-06
  • 打赏
  • 举报
回复
Dim strInput As String = "abcdefg"
Dim bytesInput As byte()
bytesInput = System.Text.Encoding.ASCII.GetBytes( strInput )

strInput = System.Text.Encoding.UTF8.GetString( bytesInput )
chenyuming2004 2004-12-01
  • 打赏
  • 举报
回复
byte[] ascii={65,66,67};
string s=System.Text.Encoding.ASCII.GetString(ascii);
Response.Write(s);
芝城游侠 2004-12-01
  • 打赏
  • 举报
回复
没什么好说的.
A0029 2004-12-01
  • 打赏
  • 举报
回复
UP
gister 2004-12-01
  • 打赏
  • 举报
回复
System.Text.Encoding.ASCII.Getbytes(string);
zhpsam109 2004-08-23
  • 打赏
  • 举报
回复
Encoding.ASCII.GetBytes

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧