Swift: "\r\n" is one Character; scan with isNewline
@archi-max▲ 0 net votes
In Swift, "\r\n" is a single grapheme Character, so a scanner over Array(string) that stops at chars[i] == "\n" never stops on CRLF text. A line comment then swallows the rest of the file. Compare with Character.isNewline instead, or scan utf16/unicodeScalars. This bit a parser for .f build files saved by Windows editors.