Trim() only trims white spaces at the start and end (leading and trailing) of the string... See docs
To remove white spaces within a string you can use:
*str*.Replace(" ", "");
Regex.Replace(*str*, @"\s", "")
where str is the string.
Also consider using a comparison method such as
*str*.Equals(*str2*, StringComparison.OrdinalIgnoreCase) instead of relying on
ToUpper(). Read How to compare strings in C#, it explains string comparison in detail.
- linq case insensitive and trimmed comparison
- Linq performing case insensitive comparison
- LINQ Contains Case Insensitive
- linq case insensitive (without toUpper or toLower)
- How to write EF in linq to include comparison by lower case
- can linq expression be case insensitive
- LINQ to DataSet case insensitive group by
- Case insensitive Contains with Dynamic Linq
- Entity Framework LINQ contains not case insensitive
- Linq case insensitive join
- Case insensitive string compare in LINQ expression
- how to build case insensitive strong typed LINQ query in c#?
- LINQ string contains another string case insensitive
- LINQ Source Code Available
- MongoDB c# driver: Case Insensitive Compare using in or contains on a list using linq
- Relax C# LINQ String Comparison (Trim, Case Insensitive, ??)
- == by default is case insensitive in c# linq
- creating Linq to sqlite dbml from DbLinq source code
- C# Expression class method extension, making string comparison case insensitive
- C# LINQ use xml with case insensitive queries
- LINQ - Refactor .Contains comparison on IEnumerable<string> to be case sensitive
- Case Insensitive Array.Contains in Linq Query
- Case insensitive LIKE condition in LINQ (with Regular Expression)
- case insensitive dynamic search for linq to entities
- LINQ case insensitive
- DataTable Linq where clause to upper case comparison
- LINQ query: How to do case insensitive query?
- Create an iQueryable which is case insensitive for unit testing linq to entities - NSubstitute
- source code for LINQ 101 samples
- Make LINQ expression case insensitive
- Get Monthly-wise data using EntityFramework
- c# LINQ OrderBy, dynamic objects, and null values
- Cast to value type 'int32' failed because the materialized value is null
- How do I sort a list using LINQ?
- How to use async within a lambda which returns a collection
- Linq Query Condition for multiple row
- How to remove duplicates from a List<List<T>> for value types T?
- Combining CheckBoxColumn and TextColumn into one column
- sql select a default row if the result is not found
- Why is LINQ's default ID(Primary Key) ReadOnly=False?
- LINQ query is not returning expected results
- How to join multiple MethodCallExpressions into one Expression?
- FIltering data in entity using two other entities
- Convert Linq to SQL
- Linq 3 value choices in column
- Getting Function Evaluation Timedout error when using function inside linq query
- LINQ - group by issues
- When using LINQ shall we use 3 layers?
- Linq Select Group By
- Query optimization challenge - Is it possible to tweak this linq query