SearchValues<string>, IndexOfAny returns matched value? #116863
-
It's very common to perform replacements in a template — for example, var searchValues = SearchValues.Create(["{Title}", "{Author}", "{Year}", "{Place}"]);
const string input = "{Title} was published by {Author} in {Year} / {Place}";
var index = input.IndexOfAny(searchValues); // what is matched? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can use Regex, which layers on top of SearchValues and adds that ability. SearchValues itself doesn't expose that because it bakes in policy about matching behavior. |
Beta Was this translation helpful? Give feedback.
You can use Regex, which layers on top of SearchValues and adds that ability. SearchValues itself doesn't expose that because it bakes in policy about matching behavior.
#110670 (comment)