Is there an easy way to insert spaces between characters in a string? I use the code below that takes a string (e.g. (UI $ .EmployeeHours * UI.DailySalary) / (month)). Since this information comes from an excel sheet, I need to insert [] for each column name. This problem occurs if the user avoids providing spaces after each paranteza, as well as the operator. Anyone to help?
text = e.Expression.Split(Splitter); string expressionString = null; for (int temp = 0; temp < text.Length; temp++) { string str = null; str = text[temp]; if (str.Length != 1 && str != "") { expressionString = expressionString + "[" + text[temp].TrimEnd() + "]"; } else expressionString = expressionString + str; }
The user can enter something like (UI $ .SlNo-UI + UI $ .Task) - (UI $ .Responsible_Person * UI $ .StartDate), while my desired result is ([UI $ .SlNo-UI] + [UI $ .Task]) - ([UI $ .Responsible_Person] * [UI $ .StartDate])
source share