Finding subscript matching in .NET.

I am trying to find the index of a substring in a string that matches another string under a specific culture (provided from System.CultureInfo).

For example, the string "ass" corresponds to the substring "aß" in "straße" under German culture.

I can find the match start index using

culture.CompareInfo.IndexOf(value, substring); 

but without resorting to brute force, is there an easy way to determine that 2 characters were matched, not 3?

+7
string unicode culture
source share
2 answers

If you use a capture group, you can capture the exact match that was found, and from this you can determine how many characters were matched.

Now I am a little outdated to give an example, so I hope you can understand this from my description.

Perhaps I will correct my answer later.

Dave

+2
source share

Regular expressions handle this difference ss vs. ß?

0
source share

All Articles