Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 2X + 5Y + z^3
- int thirdValue
- string temp;
- temp = Regex.Match(variables[3], @"d+").Value
- thirdValue = int.Parse(temp);
- string temp = textBox1.Text;
- char[] arra = temp.ToCharArray();
- int total = 0;
- foreach (char t in arra)
- {
- if (char.IsDigit(t))
- {
- total += int.Parse(t + "");
- }
- }
- textBox1.Text = total.ToString();
- string temp;
- temp = Regex.Matches(textBox1.Text, @"d+", RegexOptions.IgnoreCase)[2].Value;
- int thirdValue = int.Parse(temp);
- static class Program
- {
- static void Main()
- {
- Console.WriteLine("2X + 65Y + z^3".GetNumbersFromString().Sum());
- Console.ReadLine();
- }
- static IEnumerable<int> GetNumbersFromString(this string input)
- {
- StringBuilder number = new StringBuilder();
- foreach (char ch in input)
- {
- if (char.IsDigit(ch))
- {
- number.Append(ch);
- }
- else if (number.Length > 0)
- {
- yield return int.Parse(number.ToString());
- number.Clear();
- }
- }
- yield return int.Parse(number.ToString());
- }
- }
- Regex.Match(variables[3], @"d+").Value
- if (Regex.IsMatch(variables[3], @"d+")){
- temp = Regex.Match(variables[3], @"d+").Value
- }
Add Comment
Please, Sign In to add comment