C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

How to check


Posted Date: 07 Nov 2009      Posted By: Arun K      Member Level: Gold     Points: 1   Responses: 6



hello to all

i have one string variable and its value is

string str = "example"

now i want to check whether string contain 'example'

or not

but i want to ignore upper and lower cases when i am chking

how to do this ?

Regards:
Arun K
.NET Developer
http://aruninnice.blogspot.com/
Bangalore
Do not forget to Rate the post...





Responses

Author: Reach2Shaik    07 Nov 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

Hi,

make both the strings to upper or lower and compare.

To make str to Upper case
str = str.ToUpper();

To make str to Lower case
str =str.ToLower();

Don't forget to rate this answer, if it is helpful...
Regards Shaik



Author: Deepika Haridas    07 Nov 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

Hello,

You can write

string str = "This is an example";
CompareInfo ci = CultureInfo.CurrentCulture.CompareInfo;
if (ci.IndexOf(str, "ExaMple", CompareOptions.IgnoreCase) > 0)
{
Response.Write("Ok");
}
else
Response.Write("Wrong");




Thanks & Regards,
Deepika
Editor

If U want to shine like a SUN..First U have to burn like the SUN!!
Need a Guide? Join my mentor program..



Author: Priyank    07 Nov 2009Member Level: BronzeRating: 2 out of 52 out of 5     Points: 2

hi,

use String.contains(string value) , to finding specific word in line and put logic for case ignore you own way.

Because it is faster then IndexOf or any another method.

refer this link:

http://stackoverflow.com/questions/498686/net-is-string-contains-faster-than-string-indexof

Thanks
Priyank Maheta



Author: Shivraj Singh Rajawat    07 Nov 2009Member Level: BronzeRating: 2 out of 52 out of 5     Points: 2

use following code to compare strings......

String str="example";

if(str.ToUpper().Contains("EXAMPLE"))
Response.Write("String contains EXAMPLE");
else
Response.Write("String does not contains EXAMPLE");



Author: Nikhil Gaur    07 Nov 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

use this statement

str.ToUpper().Contains("EXAMPLE");

Join this campus group
http://www.dotnetspider.com/sites/637/-ecb-aspdotnet.aspx

Thanks & Regards
NIks
My Software and Web Development Experience



Author: Arun K    09 Nov 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

Got teh answer...

Thx buddies

Regards:
Arun K
.NET Developer
http://aruninnice.blogspot.com/
Bangalore
Do not forget to Rate the post...



Post Reply
You must Sign In to post a response.
Next : Master Page
Previous : Find control In Grid View [ In Footer Template on Dropdown Selected Index change]
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use