Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Text.RegularExpressions;
- namespace Taschenrechner
- {
- class Rechner
- {
- private static string[] EingabeArray;
- public static void Einlesen(string eingabe)
- {
- int length = 0;
- string Rechenterm = eingabe;
- // prüfung der "" leermengen
- foreach (string result in Regex.Split(Rechenterm, @"([+\-*/()]|SQRT\()"))
- {
- if (result != "") { length++; }
- }
- // Längen definition
- EingabeArray = new string[length];
- // Länge je nachdem wie viele Leerzeichen nach dem split drinne waren
- length = 0;
- foreach (string result in Regex.Split(Rechenterm, @"([+\-*/()]|SQRT\()"))
- {
- if (result != "")
- {
- EingabeArray[length] = "' " + result + " '";
- length++;
- }
- }
- for (int i = 0; i < EingabeArray.Length; i++)
- Console.WriteLine("Index:"+i+ " " +EingabeArray[i]);
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- string Test = "1234/11*(23+32)";
- Rechner.Einlesen(Test);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement