Call this method to format user codes in the following ways: 1. Leading and trailing whitespaces are removed from the original string. Characters that qualify as "whitespaces" are: '\n', '\t' and ' '. 2. Multiple statements on a single line will be broken down further into multiple statements. For example, "a = 1; b = 2;" will be broken down into two lines: "a = 1;\nb = 2;" (line break denoted by the new \n character). 3. Leading whitespaces will be removed ony for the first line. This is to preserve the indentation for lines other than the first. 4. If the resulting codes do not end with a closing curly bracket '}', then a semi-colon is appended to the code. This ensures codes like "a" will result in codes becoming "a;" |
|