gpt4 book ai didi

c# - 将字符转换为 Ascii

转载 作者:行者123 更新时间:2023-11-30 15:23:34 25 4
gpt4 key购买 nike

我一直在创建一个代码破解软件,我需要将文本文件中的字符转换为 ascii 数字以允许转换。我在下面留下了我的代码,但有人可以解释一下我该怎么做吗?

using System;
using System.IO;

namespace CipherDecoder
{
class Program
{
static void Main(string[] args)
{
string fileText = @"C:/Users/Samuel/Documents/Computer_Science/PaDS/caeserShiftEncodedText";

string cipherText = File.ReadAllText(fileText);

string output = @"C:\\Users\Samuel\Documents\Computer_Science\PaDS\output.txt\";

char[] cipherChars = new char[691];

int j = 0;

foreach (char s in cipherText)
{
cipherChars[j] = s;

j++;
}

for(int i = 0; i < cipherChars.Length; i++)
{
cipherChars[i] = cipherChars[i];
}
}
}
}

最佳答案

要将 int 值放入 int 数组中,您可以将其用作 LINQ 选择。例如:

 string fileText = @"C:/Users/Samuel/Documents/Computer_Science/PaDS/caeserShiftEncodedText";

int [] charactersAsInts = File.ReadAllText(fileText).Select(chr => (int)chr).ToArray();

关于c# - 将字符转换为 Ascii,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34314186/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com