Visual Studio Development Bookmark and Share   
 index > Visual C# Express Edition > Disregarding CASE in a string
 

Disregarding CASE in a string

Ok so I would like to detect the extension of files and treat the files differently based on their extension.

But some files of the same filetype have different extensions like ".Mp3" or ".mp3" forexample. So in stead of doing something like:

if(string extension == ".mp3" || extension == ".Mp3" || extension == ".mP3") and so on, is there a way to eliminate the case or disregard the case?

Thanks,

paoloTheCool

paoloTheCool  Wednesday, September 26, 2007 7:17 PM
if (extension.ToLower() == ".mp3")
{
return true;
}

or

if (extension.ToUpper() == ".MP3")
{
return true;
}
Cameron Kloot  Wednesday, September 26, 2007 7:53 PM
if (extension.ToLower() == ".mp3")
{
return true;
}

or

if (extension.ToUpper() == ".MP3")
{
return true;
}
Cameron Kloot  Wednesday, September 26, 2007 7:53 PM

You can use google to search for other answers

Custom Search

More Threads

• Installer problem
• Platform Development
• Extend DataGridView CheckBox Cell and Column functionality
• menuItem.Text rename
• How to drag a form?
• how to access the parallel port?
• Beginner can't begin!
• Form loaded questions
• Newbie: Why I cannot access the object?
• Connecting to a SQL server on my network from my client machine running my C# Application