Let’s say you have an input in the form field=value
, and you wanted to separate that “value” part. You would probably just use UC# String.Split
and let’s finish. But you didn’t RKhis associate.
public string FilterArg(string value)
bool blAction;
if (value.Contains('='))
blAction = false;
else
blAction = true;
string tmpValue = string.Empty;
foreach (char t in value)
if (t == '=')
blAction = true;
else if (t != ' ' && blAction == true)
tmpValue += t;
return tmpValue;
If the entry contains =
we set up blAction
on fake. Then we repeat our input, one character at a time. If the character we are on =
we set up blAction
to true. Otherwise, if the character we are on is not a space, i blAction
is true, we add the current character to our output.
I started by suggesting that we look at the native share function, because at first glance, this code looks like it.
It does the job, but the combination of flags and loops and my inability to read sometimes makes tracking even more confusing.
Keep the plebs out of production. Restrict NuGet feed privileges with ProGet. Find out more.