- Home /
Question by
Sylon87 · Nov 24, 2019 at 06:53 PM ·
stringstringsstring.split
how loop through char in a string to find tags
i have a incoming string for the dialogue system, inside there is multiple tag, i have to find it to replace with the corresponding word, i'm totally confused to how do this
incoming string s = "hello [TAG1], someday i will [TAG2]";
now i'm trying to loop like this
public string Extract(string in_tag)
{
string current = in_tag;
for (int i = 0; i < current.Length;)
{
StringBuilder sb = new StringBuilder();
}
return current;
}
but i can't figure out how to solve this
Comment
Why don't you use in_tag.Replace
or a regular expression?
https://docs.microsoft.com/en-us/dotnet/api/system.string.replace?view=netframework-4.8