Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,


This is my string value

C#
string A="O10070-A-IT-03-DC-1000";


this is my another string value

C#
string B="O10070-A-IT";


this is another string value

C#
string C="03";
string D="DC";
string E="1000";



Here , Please observe my strings it's look like a B+C+D+E=A.
now i want to check the Value of A this is mixing of B,C,D,E or not.

please help me how to compare this....
Posted
Updated 17-Jan-13 18:04pm
v2
Comments
Shanu2rick 17-Jan-13 23:44pm    
What do you mean by comparison?
[no name] 17-Jan-13 23:48pm    
that 2 values are same or not...
Jibesh 17-Jan-13 23:46pm    
you can use the string.Compare function to compare the strings what do you want more than this?

Have a look at this[^]. You can compare any string you want.
 
Share this answer
 
Comments
[no name] 17-Jan-13 23:56pm    
sorry Shanu2rick compare method is used for compare2 strings.But i don't want to compare total string , i want to compare some part of the string only.

once observe my string values it's look like this B+C+D+E=A.
so, i want to check A value it's mixing of all the B,C,D,E values or not .
that's want only i'm asking
Shanu2rick 18-Jan-13 0:08am    
You can concate all(B,C,D,E) and then compare it with String A.
[no name] 18-Jan-13 0:11am    
no, i want to check individually why because if B value is wrong means i want to display the error message for B.simillarly C,D,E also that's want only i'm asking
hi,

you can used stringvalue.contains();

see below example----


C#
if (stringValue.Contains(anotherStringValue))
{
    // Do Something //
}



hope this will help you!!!
 
Share this answer
 
Comments
[no name] 18-Jan-13 0:38am    
Thank's alot it's working fine ...
madhuri@mumbai 18-Jan-13 0:45am    
Welcome;-)

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