Esempio n. 1
0
        /// <summary>
        /// Производит поиск всех Email в исходной строке
        /// </summary>
        /// <param name="str">Исходная строка</param>
        /// <returns></returns>
        public static List <FindedDataInfo> FindEmails(string str)
        {
            var obj    = new EmailSearchStateMaсhineWithUSM();
            var result = FindEmails(str, obj);

            return(result);
        }
Esempio n. 2
0
        public static List <FindedDataInfo> FindEmails(string str, out IReadOnlyList <int> traceData)
        {
            var obj    = new EmailSearchStateMaсhineWithUSM();
            var result = FindEmails(str, obj);

            traceData = obj.stateMachine.TraceData;

            return(result);
        }
Esempio n. 3
0
        static List <FindedDataInfo> FindEmails(string str, EmailSearchStateMaсhineWithUSM stateMaсhine)
        {
            str = '^' + str + '$';

            char[] array = str.ToCharArray();
            for (stateMaсhine.position = 0; stateMaсhine.position < array.Length; stateMaсhine.position++)
            {
                char item = array[stateMaсhine.position];
                stateMaсhine.PutChar(item);
            }
            ;

            return(stateMaсhine.resultStrings);
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            richTextBoxEMailOut.Clear();

            var result = EmailSearchStateMaсhineWithUSM.FindEmails(richTextBoxEMailIn.Text.ToString(), out var traceData);

            foreach (var a in result)
            {
                richTextBoxEMailOut.AppendText($"{a.data} Индекс: {a.position} Длина адреса: {a.length}\n");
            }

            richTextBoxEMailOut.AppendText("Перечень состояний КА:\n");

            foreach (var a in traceData)
            {
                richTextBoxEMailOut.AppendText(a.ToString() + "\n");
            }
        }