Torna al Thread

char[] delimiterChars = { ' ', ',', '.', ':', '\t' }; String Text = risultatoRiconoscimentoVocale; //stringa che contiene ciò che ho pronunciato string[] words = Text.Split(delimiterChars); //array di parole divise da un delimitatore string parola; int numeroContenuto = 0; //il numero contenuto nella stringa foreach (string s in words) { parola = s + ' '; textBox2.AppendText(parola); //"appendimi" il testo in una textbox per vedere cosa ha capito if (IsNumeric(s)) //se la parola è un numero { numeroContenuto = Convert.ToInt16(s); //convertilo da stringa a intero } } if (Text.Contains("Read")) //se la stringa contiene la parola "Read" { trackBar2.Value = 120; //setta a 120 la trackbar } else if (Text.Contains("Read") && Text.Contains(numeroContenuto.ToString())) //altrimenti se contiene "Read" e un numero, settami la trackbar al numero presente nella stringa. { trackBar2.Value = numeroContenuto; }
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5