本文介绍了在richtextbox中查找符号并在side bracks中读取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想找一个符号(@)然后找到开始卷曲的括号,直到结束culry brack并读取值insid bracks ..
i want find a symbol (@) then find Start curly brack till end culry brack and read the value insid bracks..
@{
var="ak";
}
i尝试了但没有得到确切的结果...
请帮助thankyou ...
i tried it but not getting exact result...
pls help thankyou...
推荐答案
RichTextBox1.Text = "test@{test.fr}"
Dim i As Integer = RichTextBox1.Text.LastIndexOf("@{")
Dim s As String = RichTextBox1.Text.Substring(i, RichTextBox1.Text.LastIndexOf("}") - i + 1)
MessageBox.Show(s)
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
RichTextBox1.Text = "test@{test.fr}"
Dim i As Integer = RichTextBox1.Text.LastIndexOf("@{")
Dim s As String = RichTextBox1.Text.Substring(i+2, RichTextBox1.Text.LastIndexOf("}") - (i+2))
MessageBox.Show(s)
End Sub
End Class
此代码在MessageBox中返回test.fr。所以,@ {和}之间的值。
This code returns "test.fr" in the MessageBox. So, the value between "@{" and "}".
这篇关于在richtextbox中查找符号并在side bracks中读取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!