//string literals bool startSym = ss.StartsWith("'"); bool endSym = ss.EndsWith("'"); string strr = ss.Substring(1); bool strliteral = strr.Any(char.IsLetterOrDigit) || strr.Any(char.IsPunctuation) || strr.Any(char.IsSymbol); bool invalid_str = strr.StartsWith("'") && startSym && strliteral && endSym; string strspace = ss; //bool space = strspace; //&& strr.Any(char.IsSeparator) if (startSym && strliteral && endSym) { if (invalid_str) { MessageBox.Show("Error: Line num " + linecount + " Invalid String Literal b/c of multiple starting symbol"); errorcount++; break; } // if (ss.Length > 2) //valid string literal else { MessageBox.Show("this is a String Literal"); break; } }
Any
bool areThereAnyLetterOrDigitsInStrrAtAll = strr.Any(c => char.IsLetterOrDigit(c));
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)