Click here to Skip to main content
15,891,567 members
Home / Discussions / C#
   

C#

 
QuestionHow to delete a file during build/execute in C# Pin
Member 1466381121-Nov-19 5:24
Member 1466381121-Nov-19 5:24 
AnswerRe: How to delete a file during build/execute in C# Pin
OriginalGriff21-Nov-19 6:00
mveOriginalGriff21-Nov-19 6:00 
Question[Solved] Drag and Drop a folder to a textBox within a User Control Pin
W3453121-Nov-19 2:45
W3453121-Nov-19 2:45 
AnswerRe: Drag and Drop a folder to a textBox within a User Control Pin
Dave Kreskowiak21-Nov-19 4:52
mveDave Kreskowiak21-Nov-19 4:52 
GeneralRe: Drag and Drop a folder to a textBox within a User Control Pin
W3453121-Nov-19 19:47
W3453121-Nov-19 19:47 
GeneralRe: Drag and Drop a folder to a textBox within a User Control Pin
Dave Kreskowiak22-Nov-19 1:58
mveDave Kreskowiak22-Nov-19 1:58 
GeneralRe: Drag and Drop a folder to a textBox within a User Control Pin
W3453122-Nov-19 3:01
W3453122-Nov-19 3:01 
QuestionExtract variables from string math expression with parenthesis Pin
foreigh20-Nov-19 22:14
foreigh20-Nov-19 22:14 
I want to evaluate an a string math expression , so before i want to extract variables so i have to remove all special characters my code only can remove a special character like `a+b*c` and the result i get is `a=;b=;c=`, now if i write two successive special characters like `(a+b)*c` and `a++b` results will be `=;a=;b=;c=` and `a=;=;b=` always there is a sign `=;` added for no reasons how get rid of them because after that i will use mathematic functions so that will be a real problem for me please help me ! here is my code

C#
public string RemoveSpecialCharacters(string str)
       {
           StringBuilder sb = new StringBuilder();
           for(int i=0; i<str.Length;i++)
           {
               if((str[i] >= '0' && str[i] <='9')
                   ||( str[i] >='A' &&  str[i]<='z'|| (str[i]=='-' || str[i] == '+' || str[i] == '*' || str[i] == '/' || str[i] == '%'|| str[i] ==')' || str[i] == '(')))
               {
                   sb.Append(str[i]);
               }
           }
           return sb.ToString();
       }
       private void button8_Click(object sender, EventArgs e)
       {
           string refine_string = RemoveSpecialCharacters(textBox1.Text);
           string[] split_var = refine_string.Split('+', '-', '/', '%', '^', '*', '=',')','(');
           double value;
           string str = "";
           for (int i = 0; i < split_var.Length; i++)
           {
               if (double.TryParse(split_var[i], out value))
               {
                   split_var[i] = " ";
               }
           }
           split_var = split_var.Where(s => s != " ").ToArray();
           string[] variables = split_var.Distinct().ToArray();

           for (int j = 0; j < variables.Length; j++)
           {

               str = str + variables[j] + '=' + ";";

           }
           textBox2.Text = str.TrimEnd(';');

       }

AnswerRe: Extract variables from string math expression with parenthesis Pin
OriginalGriff20-Nov-19 22:56
mveOriginalGriff20-Nov-19 22:56 
GeneralRe: Extract variables from string math expression with parenthesis Pin
foreigh20-Nov-19 23:32
foreigh20-Nov-19 23:32 
GeneralRe: Extract variables from string math expression with parenthesis Pin
OriginalGriff20-Nov-19 23:50
mveOriginalGriff20-Nov-19 23:50 
QuestionHow to use recursion to build dynamic menu from database in c# Pin
Mahmoud EL-Shazly20-Nov-19 20:07
Mahmoud EL-Shazly20-Nov-19 20:07 
AnswerRe: How to use recursion to build dynamic menu from database in c# Pin
OriginalGriff20-Nov-19 21:46
mveOriginalGriff20-Nov-19 21:46 
GeneralRe: How to use recursion to build dynamic menu from database in c# Pin
Mahmoud EL-Shazly20-Nov-19 21:49
Mahmoud EL-Shazly20-Nov-19 21:49 
GeneralRe: How to use recursion to build dynamic menu from database in c# Pin
OriginalGriff20-Nov-19 21:54
mveOriginalGriff20-Nov-19 21:54 
GeneralRe: How to use recursion to build dynamic menu from database in c# Pin
Mahmoud EL-Shazly20-Nov-19 21:57
Mahmoud EL-Shazly20-Nov-19 21:57 
AnswerRe: How to use recursion to build dynamic menu from database in c# Pin
Mycroft Holmes21-Nov-19 12:56
professionalMycroft Holmes21-Nov-19 12:56 
GeneralRe: How to use recursion to build dynamic menu from database in c# Pin
Mahmoud EL-Shazly21-Nov-19 13:19
Mahmoud EL-Shazly21-Nov-19 13:19 
Question.NET Standard 2.1, Xamarin Android/iOS & Emit Pin
Super Lloyd19-Nov-19 13:00
Super Lloyd19-Nov-19 13:00 
AnswerRe: .NET Standard 2.1, Xamarin Android/iOS & Emit Pin
Super Lloyd20-Nov-19 0:45
Super Lloyd20-Nov-19 0:45 
QuestionNew Object Pool Library Pin
Justin-A-Miller19-Nov-19 8:59
Justin-A-Miller19-Nov-19 8:59 
AnswerRe: New Object Pool Library Pin
OriginalGriff19-Nov-19 9:12
mveOriginalGriff19-Nov-19 9:12 
GeneralRe: New Object Pool Library Pin
Justin-A-Miller19-Nov-19 9:22
Justin-A-Miller19-Nov-19 9:22 
GeneralRe: New Object Pool Library Pin
OriginalGriff19-Nov-19 9:51
mveOriginalGriff19-Nov-19 9:51 
GeneralRe: New Object Pool Library Pin
Justin-A-Miller20-Nov-19 3:48
Justin-A-Miller20-Nov-19 3:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.