How to Ignore Case and Check if String contains Specified ... - SAP
[Pages:3]How to Ignore Case and Check if String contains Specified Substring in C#?
C# ? Ignore Case and Check if String contains Substring
To ignore case and check if specified substring value is present in the string str , use String.Contains(String, StringComparison) method. Prepare StringComparison object comp with StringComparison.OrdinalIgnoreCase. Call Contains method on the string str and pass the substring value , and string comparison comp objects as arguments.
If the substring is present inside the string, of course ignoring the case, then String.Contains() method returns True. Else, it returns False.
C# Program
using System; class Example {
static void Main(string[] args) { String str = "abcdefgh"; String value = "CD"; StringComparison comp = StringComparison.OrdinalIgnoreCase; Boolean result = str.Contains(value, comp); Console.WriteLine($"Does string contain specified substring? {result}");
} }
Output
Does string contain specified substring? True
Conclusion
In this C# Tutorial, we learned how to check if specified substring is present in a given string while ignoring the case during string comparison.
C# Math
C# Math.Abs() C# Math.Acos() C# Math.Acosh() C# Math.Asin() C# Math.Asinh() C# Math.Atan() C# Math.Atan2() C# Math.Atanh() C# Math.BigMul() C# Math.BitDecrement() C# Math.BitIncrement() C# Math.Cbrt() C# Math.Ceiling() C# Math.Clamp() C# Math.CopySign() C# Math.Cos() C# Math.Cosh() C# Math.DivRem() C# Math.Exp() C# Math.Floor() C# Math.FusedMultiplyAdd() C# Math.IEEERemainder() C# Math.ILogB() C# Math.Log() C# Math.Log10() C# Math.Log2() C# Math.Max() C# Math.MaxMagnitude() C# Math.Min() C# Math.MinMagnitude() C# Math.Pow() C# Math.Round()
C# Math.ScaleB() C# Math.Sign() C# Math.Sin() C# Math.Sinh() C# Math.Sqrt() C# Math.Tan() C# Math.Tanh() C# Math.Truncate()
C# Tutorial C# Tutorial C# List C# Dicionary
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- python string replace tutorial kart
- strings borenstein lab
- python beginner tutorials
- computer orange template
- prxchange accept no substitutions
- using python in labeling and field calculations esri
- convert string variables to numeric variables and vice versa stata
- string manipulation with stringr cheat sheet github
- stringr simple consistent wrappers for common string operations
- string manipulation in python renan moura
Related searches
- python check if dictionary contains key
- check if array contains javascript
- check if array contains java
- check if array contains element java
- how to ignore case java
- powershell check if array contains string
- powershell if string contains text
- powershell check if string contains substring
- powershell check if string contains text
- check if string contains powershell script
- check if array contains element javascript
- powershell check if string contains character