How to use StringBuilder in this code.
string strFunc = "data /*dsdsds */ data1 /*sads dsds*/";
while (strFunc.Contains("/*"))
{
int tempStart = strFunc.IndexOf("/*");
int tempEnd = strFunc.IndexOf("*/", tempStart);
if (tempEnd == -1)
{
tempEnd = strFunc.Length;
}
strFunc = strFunc.Remove(tempStart, tempEnd + 1 - tempStart);
}
Logic is to remove commanded data from string
What you want to do is something like
no
StringBuilderis required here.However, to provide an example to the use of a
StringBuilder: to create a string which holds the removed ‘commands’, you could writebut you will have to beware of formatting here.
I hope this helps.