Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
guys does anyone tell me how to find a two or 3 word phases in a particular string.
example

String = "C Sharpe ,F sharp , A major codes."

lets say I want to search the word "c Sharpe" in the particular sting (ignoring case sensitivity)
I used following method but it did nt work for two word phases I guess.


C#
{
  if (dropdownSuppliar.Text.ToString().Trim().Contains(dt.Rows[r][0].ToString().Trim()))


{



so if anyone could help me on this matter I would be really appciated.
Thanks

[edit]SHOUTING removed - OriginalGriff[/edit]
Posted
Updated 16-May-14 21:29pm
v4
Comments
OriginalGriff 17-May-14 3:30am    
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.
Hesha 17-May-14 3:31am    
thanks

Try the other way around: You are searching your dropdown text to see if contains the DataTable value...
 
Share this answer
 
C#
if(dropdownSuppliar.Text.ToLower().IndexOf(searchStr.ToLower()) >-1)
{

}
 
Share this answer
 
thanks originalGriff ,it is working now.I should do other way around ,My mistake
thanks a Lot

C#
{
  if (dt.Rows[r][0].ToString().Trim().Contains(dropdownSuppliar.Text.ToString().Trim()))
					 
					
						{
 
Share this answer
 
Comments
[no name] 17-May-14 12:41pm    
Use comments to give a feedback. This will avoid downvotes.... Mr. Jack Sparrow ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900