Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 18, 2012 11:57 AM by RameshRajendran
Member
310 Points
340 Posts
Nov 18, 2012 10:12 AM|LINK
Hi, how can I compare 2 strings such that 'String variable' will return true because of the word match 'man', I have tried Charindex and Like but still can't figure out how to do this:
String variable: 'thisisamanbird'
String base: tiger,man,lion
12 Points
1 Post
Nov 18, 2012 11:46 AM|LINK
Hi k80sg,
I think in this senario you can split the value in the base variable and then compare it with variable 'variable'.
Code:
String variable= "thisisamanbird"; String value= "tiger,man,lion"; string [] str= value.Split(','); for (int iterator = 0; iterator < str.Length; iterator++) { if (variable.Contains(str[iterator])) { MessageBox.Show("contains value " + str[iterator] + " in " + variable); } }
Thanks & Regards,
Darvin Davis Moonjely
Star
7983 Points
2099 Posts
Nov 18, 2012 11:57 AM|LINK
hai
furst ref this .then u can compare in u r strings
http://msdn.microsoft.com/en-us/library/fbh501kz.aspx
http://cplus.about.com/od/learnc/ss/strings_6.htm
http://csharp.net-informations.com/string/csharp-string-compare.htm
Thank you
k80sg
Member
310 Points
340 Posts
Comparing two strings
Nov 18, 2012 10:12 AM|LINK
Hi, how can I compare 2 strings such that 'String variable' will return true because of the word match 'man', I have tried Charindex and Like but still can't figure out how to do this:
String variable: 'thisisamanbird'
String base: tiger,man,lion
Darvin Davis...
Member
12 Points
1 Post
Re: Comparing two strings
Nov 18, 2012 11:46 AM|LINK
Hi k80sg,
I think in this senario you can split the value in the base variable and then compare it with variable 'variable'.
Code:
String variable= "thisisamanbird"; String value= "tiger,man,lion"; string [] str= value.Split(','); for (int iterator = 0; iterator < str.Length; iterator++) { if (variable.Contains(str[iterator])) { MessageBox.Show("contains value " + str[iterator] + " in " + variable); } }Thanks & Regards,
Darvin Davis Moonjely
RameshRajend...
Star
7983 Points
2099 Posts
Re: Comparing two strings
Nov 18, 2012 11:57 AM|LINK
hai
furst ref this .then u can compare in u r strings
http://msdn.microsoft.com/en-us/library/fbh501kz.aspx
http://cplus.about.com/od/learnc/ss/strings_6.htm
http://csharp.net-informations.com/string/csharp-string-compare.htm
Thank you
RameshRajend...
Star
7983 Points
2099 Posts
Re: Comparing two strings
Nov 18, 2012 11:57 AM|LINK
hai
furst ref this .then u can compare in u r strings
http://msdn.microsoft.com/en-us/library/fbh501kz.aspx
http://cplus.about.com/od/learnc/ss/strings_6.htm
http://csharp.net-informations.com/string/csharp-string-compare.htm
Thank you