将十进制转换为Ascii,但我有不同格式的十进制?

时间:2016-03-25 12:05:15

标签: vb.net visual-studio-2015

@Verdolino帮助我将字符串从Ascii转换为十进制,并对每个Char执行一些操作并在文本框中收集它们。 这是代码:

 Dim sText As String
    sText = TextBox6.Text
    sASC = sText.Select(Function(t) (BigInteger.Pow(Asc(t), ee) Mod n).ToString()).Aggregate(Function(t1, t2) t1 & "," & t2)
    TextBox7.Text = sASC

我想要这样的输入: Input: 912,697,583,1065,261 operation = 912^3 mod 1073,697^3 mod 1073,583^3 mod 1073,1065^3 mod 1073,261^3 mod 1073 output: Ascii code of each group of numbers between comma.

1 个答案:

答案 0 :(得分:1)

升级

Dim rr As String = TextBox10.Text
textbox11.text = ""
Dim numbers As String() = rr.Split(","C)
    For Each number As String In numbers
        Dim tempNumb as BigInteger =  ((BigInteger.Parse(number))^3) mod 1073
        Try
            Dim asciiChar As Char = Chr(tempNumb)
        Finally
            textbox11.text = textbox11.text + " There is no ascii code for: " + tempNumb
        End Try
        textbox11.text = textbox11.text + tempNumb
    Next

使用hex:

Dim rr As String = TextBox10.Text
    textbox11.text = ""
    Dim numbers As String() = rr.Split(","C)
        For Each number As String In numbers
            Dim tempNumb as BigInteger =  ((BigInteger.Parse(number))^3) mod 1073
            Try
                Dim hexNumber as Integer = Hex(tempNumb)
                Dim intFromHex as Integer = Convert.ToInt32(hexNumber, 16)
                Dim asciiChar As Char = Chr(tempNumb)
            Finally
                textbox11.text = textbox11.text + " There is no ascii code for: " + tempNumb
            End Try
            textbox11.text = textbox11.text + tempNumb
        Next