How to compare two strings with out Case sensitive ?

Answers were Sorted based on User's Feedback



How to compare two strings with out Case sensitive ?..

Answer / minhajul islam

string str1="Hello1";
string str2="Hello2";

String.Compare(str1,str2,true)

//true if you want compare two string without case
sensative and false if you want to case sensative.

//It will return Zero if compare as equal and 1 if not.

Is This Answer Correct ?    16 Yes 2 No

How to compare two strings with out Case sensitive ?..

Answer / navin.cp

Here is the code that solve ur problem:

string str = "virtual";
if (str.Equals("virtual"))
{
// your code here....
}

Is This Answer Correct ?    8 Yes 6 No

How to compare two strings with out Case sensitive ?..

Answer / manu

with
String.Compare(string a,string b) [result 0 only when it
is equal- since it compares by subtracting ascii of b from
ascci of a)
or
String.Equals(string a,string b) {true if it is equal]
we can achieve the same

Is This Answer Correct ?    5 Yes 6 No

How to compare two strings with out Case sensitive ?..

Answer / sekar thangavel

sting.Equals(string a,string b)

Explanation:
Determines whether two specified system.string objects have
the same values,a parameter specifies the culture,case and
sort rules used in the comparison

Is This Answer Correct ?    4 Yes 7 No

Post New Answer

More ASP.NET Interview Questions

Describe the difference between a Thread and a Process?

4 Answers  


Define web services in asp.net.

0 Answers  


what if we delete web.config or machine.config? will a website work if we delete webconfig....or if we delete machine config?

4 Answers   TCS,


what is view state and its use

10 Answers   DELL, Efextra, HCL,


Explain Authentication mechanism in dotnet

0 Answers   BirlaSoft,






can sn.exe can be used before gacutil.exe

2 Answers   Accenture,


Describe in brief .net framework and its components.

0 Answers  


What is the good practice to implement validations in aspx page?

0 Answers  


How can you execute stored procedure from windows application?

1 Answers   Microsoft,


Explain login controls.

0 Answers  


What are the ways to show data grid inside a data grid for a master details type of tables? If we write any code for DataGrid methods, what is the access specifier used for that methods in the code behind file and why?

0 Answers  


What is the difference between CC and BCC?

0 Answers   MCN Solutions,


Categories