How to split a string while ignoring the case of the delimiter?

javascript split ignore case
es6 split string
react split string
typescript string split
how to split string in c# and store it in array
javascript regex ignore case
mdn split string into array
how do i split a string with multiple separators in javascript

I need to split a string let's say "asdf aA asdfget aa uoiu AA" split using "aa" ignoring the case. to

"asdf "
"asdfget "
"uoiu "

There's no easy way to accomplish this using string.Split. (Well, except for specifying all the permutations of the split string for each char lower/upper case in an array - not very elegant I think you'll agree.)

However, Regex.Split should do the job quite nicely.


var parts = Regex.Split(input, "aa", RegexOptions.IgnoreCase);

Ignore case of the delimiter in C# Split function, Is there a way to ignore case of the delimiter while splitting a string? Example: string sampleInput = @"String validation:  I am using .NET's String.Split method to break up a string using commas, but I want to ignore strings enclosed in double quotes for the string. I have read that a . For example, the string below. Fruit,10,"Bananas, Oranges, Grapes" I would like to get the following . Fruit 10 "Bananas, Oranges, Grapes" Currently I am getting the following output

If you don't care about case, then the simplest thing to do is force the string to all uppercase or lowercase before using split.

stringbits = datastring.ToLower().Split("aa")

If you care about case for the interesting bits of the string but not the separators then I would use String.Replace to force all the separators to a specific case (upper or lower, doesn't matter) and then call String.Split using the matching case for the separator.

strinbits = datastring.Replace("aA", "aa").Replace("AA", "aa").Split("aa")

How to split a string while ignoring the case of the delimiter?, I need to split a string let's say "asdf aA asdfget aa uoiu AA" split using "aa" ignoring the case. to. "asdf "; "asdfget "; "uoiu "  I am using the .Split(',') method on a string that I know has values delimited by commas and I want those values to be separated and put into a string[] object. This works great for strings like t

In your algorithm, you can use the String.IndexOf method and pass in OrdinalIgnoreCase as the StringComparison parameter.

How to split a string while ignoring the case of the delimiter?, I need to split a string let's say "asdf aA asdfget aa uoiu AA" split using "aa" ignoring the case. One of the more recent functions I've needed for personal and work purposes is to split a string on a delimiter, but while ignoring the delimiter when inside a quote. Just as well, if within a quote then two adjacent double-quotes ("") should be treated as a double-quote escape, and as such should be output directly into the resultant string.

My answer isn't as good as Noldorin's, but I'll leave it so people can see the alternative method. This isn't as good for simple splits, but it is more flexible if you need to do more complex parsing.

using System.Text.RegularExpressions;

string data = "asdf aA asdfget aa uoiu AA";
string aaRegex = "(.+?)[aA]{2}";

MatchCollection mc = Regex.Matches(data, aaRegex);

foreach(Match m in mc)

Java extract string between single quotes, need when creating your Pattern class. How to split string ignoring stuff in quotes forums. So in your case, the delimiter are before and after the single quotes. Case insensitive String split() method. // ^^ ^^ // string delimiter This has the advantage that if you want to build the list of delimiters Split string by

It's not the pretties version but also works:

"asdf aA asdfget aa uoiu AA".Split(new[] { "aa", "AA", "aA", "Aa" }, StringSplitOptions.RemoveEmptyEntries);

Split string or character vector at specified delimiter, The matches output argument contains all occurrences of delimiters upon which strsplit splits str . You can use this syntax with any of the input arguments of the  Split using delimiter except when delimiter is escaped. but unfortunately, excel is passing cell text instead of cell values. When the cells are using special formatting (such as the thousands seperator), the clipboard data for a series of cells in columns that looks like this: is stored as this:

String (Java SE 11 & JDK 11 ), Compares two strings lexicographically, ignoring case differences. the CharSequence elements joined together with a copy of the specified delimiter . Splits this string around matches of the given regular expression. The CharsetDecoder class should be used when more control over the decoding process is required. Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

Split strings in Python (delimiter, line break, regex, etc.), For example, it is useful when you want to delete the first line from a string. If sep​='\n' , maxsplit=1 , you can get a list of strings split by the first  A table-valued function that splits a string into rows of substrings, based on a specified separator character. Compatibility level 130. STRING_SPLIT requires the compatibility level to be at least 130. When the level is less than 130, SQL Server is unable to find the STRING_SPLIT function.

Split a string using String.split(), The String class has a split() (since 1.4) method that will return a String array. public class StringSplit The result does not include the empty strings between the "|" separator. To keep the empty Special cases using String.split():. public class  Split can be defined as a function that can split a text string into an array, by making use of a delimiter character. It returns a zero-based, one-dimensional array holding the parts of the original text string. The Syntax of VBA Split Statement is as follows: Split (text_string, delimiter, limit, compare) Here, ‘ text_string ’ refers to

  • Plus1 for not using real words but still maintaining continuity of the question
  • No problem. And yeah, it's one of those little hidden gems in the framework.
  • Visual Basic does this so easily (with Strings.Split)... Am I actually going to regret switching to C#?
  • So there is no way to take advantage of String.Split?
  • Yeah, this is what I meant by permutations - it becomes quite cumbersome for longer split strings.