[C#]找到一个字后的字? [英] [C#] find word after a word?
本文介绍了[C#]找到一个字后的字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好ppl!如何让我的应用程序在一个单词后找到一个单词?我在VB.NET中使用以下代码完成了这个:
Dim str As String = TextBox1.Text $ .Replace(,vbNullString )
TextBox1.Text = TextBox2.Text $ .Substring(TextBox2.Text $ .IndexOf(str)+ Val(str.Length + 1))。Split()(0)
但是,当我使用VB.NET转C#转换器时,我得到这个代码:
string str = textBox1.Text.Replace(,null);
textBox1.Text == textBox2.Text.Substring(textBox2.Text.IndexOf(str)+ Conversion.Val(str.Length + 1))。Split()(0);
我收到错误,例如当前上下文中不存在转换。有人可以帮忙吗?
我尝试过:
string str = textBox1.Text.Replace(,null);
textBox1.Text == textBox2.Text.Substring(textBox2.Text.IndexOf(str)+ Conversion.Val(str.Length + 1))。Split()(0);
解决方案
.Replace(,vbNullString)
TextBox1.Text = TextBox2.Text
。子串(TextBox2.Text
.IndexOf(str)+ Val(str.Length + 1))。分割()(0)
但是,当我使用VB.NET到C#转换器时,我得到这个代码:
string str = textBox1.Text.Replace(,null);
textBox1.Text == textBox2.Text.Substring(textBox2.Text.IndexOf(str)+ Conversion.Val(str.Length + 1))。Split()(0);
我收到错误,例如当前上下文中不存在转换。有人可以帮忙吗?
我尝试过:
string str = textBox1.Text.Replace(,null);
textBox1.Text == textBox2.Text.Substring(textBox2.Text.IndexOf(str)+ Conversion.Val(str.Length + 1))。Split()(0);
Hello ppl! How can I make my application find a word after a word? I have done this in VB.NET with this code:
Dim str As String = TextBox1.Text$.Replace(" ", vbNullString) TextBox1.Text = TextBox2.Text$.Substring(TextBox2.Text$.IndexOf(str) + Val(str.Length + 1)).Split(" ")(0)
But, when I use VB.NET to C# converter I get this code:
string str = textBox1.Text.Replace(" ", null); textBox1.Text == textBox2.Text.Substring(textBox2.Text.IndexOf(str) + Conversion.Val(str.Length + 1)).Split(" ")(0);
I get errors, such as 'Conversion' does not exist in the current context. Can anyone help?
What I have tried:
string str = textBox1.Text.Replace(" ", null); textBox1.Text == textBox2.Text.Substring(textBox2.Text.IndexOf(str) + Conversion.Val(str.Length + 1)).Split(" ")(0);
解决方案
.Replace(" ", vbNullString) TextBox1.Text = TextBox2.Text
.Substring(TextBox2.Text
.IndexOf(str) + Val(str.Length + 1)).Split(" ")(0)
But, when I use VB.NET to C# converter I get this code:
string str = textBox1.Text.Replace(" ", null); textBox1.Text == textBox2.Text.Substring(textBox2.Text.IndexOf(str) + Conversion.Val(str.Length + 1)).Split(" ")(0);
I get errors, such as 'Conversion' does not exist in the current context. Can anyone help?
What I have tried:
string str = textBox1.Text.Replace(" ", null); textBox1.Text == textBox2.Text.Substring(textBox2.Text.IndexOf(str) + Conversion.Val(str.Length + 1)).Split(" ")(0);
这篇关于[C#]找到一个字后的字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文