小编sha*_*oro的帖子

替换第n个位置的字符

我正在编写这个程序来替换文本文件中字符串第n个位置的字符.我的文本文件包含以下内容 -

the quick brown fox jumped over the lazy dog
the quick brown fox jumped over the lazy dog
the quick brown fox jumped over the lazy dog
the quick brown fox jumped over the lazy dog
Run Code Online (Sandbox Code Playgroud)

这是代码的输出 -

thehuick brown fox jumped over the lazy dog
Run Code Online (Sandbox Code Playgroud)

以上结果不是我想要的.只更新了一行,其余的行不再在文件中找到.

这是我在C#中的完整代码

        var txtFiles = Directory.GetFiles(@"E:\PROJ\replaceY\replaceY\", "*.txt");
        foreach (string currentFile in txtFiles)
        {
            string[] lines = File.ReadAllLines(currentFile);
            foreach (string line in lines)
            {

                var theString = line;
                var aStringBuilder = new StringBuilder(theString); …
Run Code Online (Sandbox Code Playgroud)

c# asp.net

6
推荐指数
1
解决办法
670
查看次数

Mysql存储过程插入数据库表,缺少半冒号错误

我是第一次在mysql中创建这个存储过程而我偶然发现了这个"半冒号丢失"错误而且我被卡住了.这是代码

    drop procedure if exists `Insert_User`;
    create procedure Insert_User(param1 varchar(20),param2 varchar(20))
    begin
        insert into login(username, password) values(param1, param2);
    end;
Run Code Online (Sandbox Code Playgroud)

请帮忙

mysql syntax stored-procedures

1
推荐指数
1
解决办法
4919
查看次数

标签 统计

asp.net ×1

c# ×1

mysql ×1

stored-procedures ×1

syntax ×1