Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# replace string case insensitive

class Program
{
    static void Main()
    {
        string input = "hello WoRlD";
        string result = 
           Regex.Replace(input, "world", "csharp", RegexOptions.IgnoreCase);
        Console.WriteLine(result); // prints "hello csharp"
    }
}
Comment

string.Replace that is case-insensitive in C#

/// 11/11/2022 Mahesh Kumar Yadav. <br/>
/// <summary>
/// No case sensitive in string replace
/// </summary>
/// <param name="originalString"></param>
/// <param name="oldValue"></param>
/// <param name="newValue"></param>
/// <returns></returns>
static string CaseInsenstiveReplace(string originalString, string oldValue, string newValue)
{
     Regex regEx = new Regex(oldValue,
     RegexOptions.IgnoreCase | RegexOptions.Multiline);
     return regEx.Replace(originalString, newValue);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# check if element is last in list 
Csharp :: get random file in directory c# 
Csharp :: c# reverse string 
Csharp :: c# how to add newline on text box 
Csharp :: unity detect number key 
Csharp :: unity destroy object when out of screen 
Csharp :: get all files in all subdirectories c# 
Csharp :: load scene unity 
Csharp :: how to make rb.addforce 2d 
Csharp :: shaking camera in c# 
Csharp :: difference between namespace and assembly in c# 
Csharp :: unity array to list 
Csharp :: oncollisionenter unity 
Csharp :: c# exit 
Csharp :: unity know when mouse on ui 
Csharp :: xml node update attribute value c# 
Csharp :: string to uint c# 
Csharp :: search the third word in string in c# 
Csharp :: c# conver date utc to cst 
Csharp :: How can I make an action repeat every x seconds with Timer in C#? 
Csharp :: how to turn off sprite renderer in unity 
Csharp :: list of gender binary terrorists 
Csharp :: shorthand in c# operator 
Csharp :: asp textarea 
Csharp :: unity detect if animation is playing 
Csharp :: add admin priviledge to c# program 
Csharp :: transfer ownership photon2 
Csharp :: c# negative index 
Csharp :: c# get size of file 
Csharp :: how to make an object jump in unity 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =