x="a[11dsfsf]b"
站在用户的角度思考问题,与客户深入沟通,找到溧水网站设计与溧水网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:网站建设、成都网站制作、企业官网、英文网站、手机端网站、网站推广、国际域名空间、虚拟空间、企业邮箱。业务覆盖溧水地区。
b=x.lastindexof("]")
a=x.indexof("[")
x=x.substring(0,a) "0" x.substring(b)
这个简单,截取字符串就行了
TextBox1.Text = TextBox1.Text.Substring(0, 2) "BB" TextBox1.Text.Substring(4, 2)
文本框 TextBox1
上一条 Button1
下一条 Button2
修改 Button3
Imports System.IO
Public Class Form1
Dim currIndex As Integer = 0
Dim s2 As List(Of String) = New List(Of String)
Dim s As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
s = File.ReadAllText(Application.StartupPath "\txt.txt")
Dim s1 As String() = s.Split("@")
For i As Integer = 0 To s1.Length - 1
If s1(i).Trim() "" Then
s2.Add("@" s1(i))
End If
Next
TextBox1.Text = s2(0)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
currIndex = currIndex + 1
If currIndex s2.Count - 1 Then
MsgBox("已经是最后条了")
Return
End If
TextBox1.Text = s2(currIndex)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
currIndex = currIndex - 1
If currIndex 0 Then
MsgBox("已经是第一条了")
Return
End If
TextBox1.Text = s2(currIndex)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
s2(currIndex) = TextBox1.Text
s = ""
For i As Integer = 0 To s2.Count - 1
s = s2(i)
Next
File.WriteAllText(Application.StartupPath "\txt.txt", s)
End Sub
End Class
语法错误,没有存储函数的返回值。
temp.Replace("111", "22")
这个函数方法返回修改后的结果,并不修改参数变量本身,也就是按值传递,而不是按地址传递,正确用法:
temp=temp.Replace("111", "22")
变通的方法:
首先 把List 替换为一个其他的字符串如OOO,要全字匹配替换。然后替换List为fList,然后再把OOO替换为List。
将dll以文件方式以UTF-8的方式读入,然后接下来就替换字符串就可以了嘛
C#:
using System.IO;
...
string text;
text=File.ReadAllText(FilePath, Encoding.UTF8);
text.Replace("...","...");
...
-------------------------
还要谢谢你,不然我还不知道是UTF-8的编码格式,我有一个验证的问题可以解决了。