Alright, so I'm going to jump in with my situation:
So I have string[] MyStringArray
with "hello", "goodbye", "morning" in it,
MatchString = "hel"
,
Now, on a specific trigger, I'd like to be able to loop through the strings in MyStringArray
, and find the most开发者_开发百科 likely match, and replace.
So for instance, say I had the string "Hello, and good mor" and then I trigger the event, I'd want the resulting string to be "Hello, and good morning".
Same would be true for "I have got to go, go" -> "I have got to go, goodbye"
EDIT: I want on the trigger to only take the last word, separated by a space.
errrr....
why doesn't "i have got to go, go" turn into "i have got to goodbye, gooodbye"?
and..
"Hello, and good mor" isn't "Hello, and goodbye morning"
You can use the .StartsWith() method, i.e.
foreach (var str in MatchArray)
{
if (str.StartsWith(MatchString))
{
//it's a possible match
}
}
But you have to deal with multiple matches seperately
Intellisense: Home-Made - Based on Visual Studio By James Gupta
精彩评论