unsafe string RemoveComments(string source) { fixed(char *str = source) { String result = source; int startPos; while ((startPos = CString.FindStringPosition(result, "/*")) != -1) { int endPos = CString.FindStringPosition(result, "*/"); Debug.Assert(endPos != -1); result = result.Remove(startPos, endPos - startPos + 2); } while ((startPos = CString.FindStringPosition(result, "//")) != -1) { int endPos = CString.FindStringPosition(result, "\n", startPos); Debug.Assert(endPos != -1); result = result.Remove(startPos, endPos - startPos + 1); } return(result); } }