2
For example, the user places in a textarea "1234 5678 1011 1213" I made a system that puts point and comma in each space, now I need to know how to store a digit sequence in an array, so I can make a code that after 6 sequences, skip a line.
For example, the user type: 1090 5411 1006 / 6061 - 4025 4587 6518 / 7892
System already modifies to: 1090;5411;1006;6061;4025;4587;6518;7892
And I wish that every six sequences of numbers, he would skip one line: 1090;5411;1006;6061;4025;4587; 6518;7892
private void btnHSCode_Click(object sender, EventArgs e)
{
var hs = hs_codes.Text;
var texto = new StringBuilder(hs.Length);
var digito = true;
foreach (var chr in hs)
{
if (char.IsDigit(chr))
{
if (!digito) texto.Append(';');
texto.Append(chr);
digito = true;
}
else digito = false;
}
txt_alterado.ReadOnly = false;
txt_alterado.Focus();
txt_alterado.Text = texto.ToString();
}
Then to separate into
String[]
use the method String.Split(char) using ';' as parameter.var strarr = txt_alterado.Text.Split(';');
– Augusto Vasques