TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
-------
NA
213
6.9k
get the new word from the second string
Oct 5 2020 8:05 AM
I am trying to get the new words from the second string when match the same word(second string) from another string(first string)
Current output is:
Insert Word Is: matching hims by website
I want to:
Insert Word Is: by website
.cs
protected
void
Button1_Click(
object
sender, EventArgs e)
{
if
(IsPostBack)
{
Label3.Text =
""
;
}
var result1 = stextbox.Text.Split(
new
char
[] {
' '
}).Except(ftextbox.Text.Split(
new
char
[] {
' '
})).ToArray();
int
count = 0;
count = result1.Length;
//string lastWord = result1[result1.Length - 1];
for
(
int
i = 0; i < count; i++)
{
Label3.Text += result1[i].ToString() +
" "
;
}
Label3.Text =
"Insert Word Is: "
+ Label3.Text;
//below code is get the last word
//var result1 = stextbox.Text.Split(new char[] { ' ' }).Except(ftextbox.Text.Split(new char[] { ' ' })).ToArray();
//int count = 0;
//count = result1.Length;
//string phrase = ftextbox.Text;
//string subPhrase = stextbox.Text;
//subPhrase = phrase;
//string temp;
//while (true)
//{
// temp = subPhrase.Substring(1 + subPhrase.IndexOf(" "));
// if (temp.Equals(subPhrase))
// {
// break;
// }
// else
// {
// subPhrase = temp;
// }
//}
//Label3.Text = "Insert Word Is: " + temp;
.aspx
<asp:TextBox ID=
"ftextbox"
runat=
"server"
TextMode=
"MultiLine"
Width=
"500px"
Height=
"200px"
></asp:TextBox>
<asp:TextBox ID=
"stextbox"
runat=
"server"
TextMode=
"MultiLine"
Width=
"500px"
Height=
"200px"
></asp:TextBox>
<br /><br />
<asp:Button ID=
"Button1"
runat=
"server"
Text=
"Compare"
OnClick=
"Button1_Click"
/>
<br />
need help
Reply
Answers (
8
)
Dropdownlistfor not binding with string array in razor syntax in MVC5
MVC5 CRUD Operation