gpt4 book ai didi

c# - 需要打乱选定的文本

转载 作者:太空宇宙 更新时间:2023-11-03 15:23:50 24 4
gpt4 key购买 nike

    protected void Button_Upload_Click(object sender, EventArgs e)
{
string path = Server.MapPath("~/Data/" + FileUpload1.FileName);
string[] readtext = File.ReadAllLines(path);
var a = readtext;
List<string> strList = new List<string>();
foreach (string s in readtext)
{
strList.Add(s);
}
ListBox1.DataSource = strList;
ListBox1.DataBind();
}

protected void Button1_Click(object sender, EventArgs e)
{
var b = ListBox1.SelectedIndex;
var a = ListBox1.SelectedValue.ToString();
if (b < 0)
{
// no ListBox item selected;
return;
}

StringBuilder jumbleSB = new StringBuilder();
jumbleSB.Append(a);
Random rand = new Random();
int lengthSB = jumbleSB.Length;
for (int i = 0; i < lengthSB; ++i)
{
int index1 = (rand.Next() % lengthSB);
int index2 = (rand.Next() % lengthSB);
Char temp = jumbleSB[index1];
jumbleSB[index1] = jumbleSB[index2];
jumbleSB[index2] = temp;

}

Console.WriteLine(jumbleSB);

TextBox1.Text = ListBox1.Text.ToString();
//TextBox1.Text = ListBox1.Text.Insert(jumbleSB);

这里我需要混淆用户选择的值。当用户选择一个值时,它必须困惑并且必须进入文本框。我无法显示 Jumble 值。任何帮助请...?

最佳答案

Console.WriteLine(jumbleSB.ToString());

关于c# - 需要打乱选定的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36147338/

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