I am trying to make error free user input. When there is a one split symbol user might type it and create an error which I must fix before executing creating more lines of code. Is there a way of splitting a string using for example $%$ instead of just $ character?
This is how I do splitting using one character:
if (!lastUsed.EmptyFile())
{
string[] allSettings = lastUsed.Text.Split('$');
int settingCount = 0;
foreach (string setting in allSettings)
{
settingCount++;
if (settingCount == 1)
{
txtText.Text = setting;
}
else if (settingCount == 2)
{
if (setting == "0") tbType.SelectedTab = tbInterval;
else tbType.SelectedTab = tbRange;
}
else if (settingCount == 3)
{
nudInterval.Value = decimal.Parse(setting);
}
else if (settingCount == 4)
{
nudMin.Value = decimal.Parse(setting);
}
else if (settingCount == 5)
{
nudMax.Value = decimal.Parse(setting);
}
}
}
You can use a string as the delimiter.