kOS.ContextRunProgram.stripComment C# (CSharp) Method

stripComment() public method

public stripComment ( string line ) : string
line string
return string
        public string stripComment(string line)
        {
            for (var i=0; i<line.Length; i++)
            {
                if (line[i] == '\"')
                {
                    i = Utils.FindEndOfString(line, i + 1);
                    if (i == -1) break;
                }
                else if (i < line.Length - 1 && line.Substring(i, 2) == "//")
                {
                    return line.Substring(0, i);
                }
            }

            return line;
        }