Linked Questions
32 questions linked to/from How can I do a case insensitive string comparison?
12
votes
5
answers
1k
views
C# Comparing strings with different case [duplicate]
I'm reading a username and then checking to see if exists in another database table, the problem is whilst the username is the same the case maybe different and is preventing it from finding a match ...
1
vote
5
answers
3k
views
Case Insensitive Interpretation C# [duplicate]
I'm making a text game, and I have one method for getting the input from the player and another for processing that input. However, it only works if the player types the command all in lowercase. I ...
-5
votes
2
answers
7k
views
Is .Contains case-sensitive in .Net? [duplicate]
Is the string-method .Contains case-sensitive in .Net?
For example:
string str1 = "tEst";
string str2 = "Te";
Boolean bool = str1.Contains(str2);
0
votes
1
answer
3k
views
How to check csv file type in c# [duplicate]
I am checking the csv extension as below:
string extension = System.IO.Path.GetExtension(UploadFile.PostedFile.FileName);
//check file extension
if (!(extension == ".csv"))
{
}
...
-2
votes
1
answer
2k
views
How to compare strings at C# like in SQL server case insensitive and accent insensitive [duplicate]
Alright here 4 words which are equal at SQL server Latin1_General_100_CI_AI collation which is case insensitive and accent insensitive
taraflı
TaraFLI
TARaFLİ
Tarafli
However i could not find a way ...
0
votes
3
answers
1k
views
How to force the user's input to lower case or any other way to make the user's input case insensitive [duplicate]
Quick question. New to C# and as practice made a simple guessing game, but trying to make the guess case insensitive. In the below example the secret word = "cow", but I want "Cow" ...
-2
votes
4
answers
373
views
how to compare string without case sensitive using c#? [duplicate]
What is the best way to compare two string without case sensitive using c#?
Am using the below codes.
string b = "b";
int c = string.Compare(a, b);
2
votes
2
answers
358
views
How to ignore case sensitivity in a response from the user in c#? [duplicate]
This is my very rudimentary guessing game. The answer is "luigi", but if I type "Luigi", it doesn't register as a valid answer because my secretWord (luigi) is not in the same caps. how do I get ...
0
votes
1
answer
125
views
How to user SingleOrDefault with different string letter case? [duplicate]
This is for the intranet. When I search for the username it comes out with lower case.
When I search for the username within the table it never finds the username because it seems it needs to be ...
0
votes
2
answers
85
views
How to use both lower case and upper case in GUILayout.TextField? [duplicate]
searchString = GUILayout.TextField(searchString, GUI.skin.FindStyle("ToolbarSeachTextField"));
if I have for example: Guid it will find it only I start typing with G...Gui
but if I will ...
0
votes
0
answers
31
views
Accept Uppercase and Lowercase as True in C# [duplicate]
I want my code to detect my input even if it's Uppercase or Lowercase as true but I don't know how to, someone help me, thanks, here's some examples if you guys are confused:
Input:
y or Y
Output:
...
7592
votes
67
answers
1.4m
views
What is the difference between String and string in C#?
What are the differences between these two, and which one should I use?
string s = "Hello world!";
String s = "Hello world!";
181
votes
13
answers
154k
views
Is there a C# case insensitive equals operator?
I know that the following is case sensitive:
if (StringA == StringB) {
So is there an operator which will compare two strings in an insensitive manner?
248
votes
4
answers
177k
views
String comparison: InvariantCultureIgnoreCase vs OrdinalIgnoreCase? [duplicate]
Which would be better code:
int index = fileName.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase);
or
int index = fileName.LastIndexOf(".", StringComparison.OrdinalIgnoreCase);
222
votes
5
answers
100k
views
Which is generally best to use — StringComparison.OrdinalIgnoreCase or StringComparison.InvariantCultureIgnoreCase?
I have some code like this:
If key.Equals("search", StringComparison.OrdinalIgnoreCase) Then
DoSomething()
End If
I don't care about the case. Should I use OrdinalIgnoreCase, ...