如何将所有ascii转换为纯文本

时间:2018-02-12 02:29:29

标签: vb.net

这是代码:

Private Sub BtnConvert_Click(sender As Object, e As EventArgs) Handles BtnConvert.Click
    ConvertedTXT.Clear()
    If TxtAscii.Checked = True Then
        While TheLength <> WaitingTXT.Text.Length
            ConvertedTXT.Text += (AscW(WaitingTXT.Text(TheLength)) & " ")
            TheLength += 1
        End While
        TheLength = 0
    ElseIf AsciiTxt.Checked = True Then
        ConvertedTXT.Text += (ChrW(WaitingTXT.Text(TheLength)) & " ")
    End If
End Sub

如果您愿意,也可以拥有图片:https://prnt.sc/idfi7v

好吧,将所有文本转换为ascii我得到它,但相反没有。

OBS:我宣布变量&#34; TheLength&#34;双倍。

1 个答案:

答案 0 :(得分:0)

检查此示例

Dim input As String = "Hello^world" ' change this into your input
Dim replaced As String = System.Text.RegularExpressions.Regex.Replace(input, "[^a-zA-Z0-9]", " ")
Console.WriteLine(replaced) ' output: Hello world