in the program, i have to handle a input table like this.
a:1
b:2
c:3
?:6
#:14
obviously, delimiter is ":" and "\n"
however, input like this will catch an exception
::2
I want to make ':' store into a char list as well.
how do i modify these code? and where should I put try-catch in?
String[] str;
str = textbox.Text.Trim().Split(':', '\n');
for (i = 0; i < str.Length; i = i + 2){
char tempC;
float tempFreq;
if (char.TryParse(str[i], out tempC))
c.Add(tempC);
if (float.TryParse(str[i + 1], out tempFreq))
freq.Add(tempFreq);
}