日記
今日は病院めぐり疲れた…また結果を聞きに市街にでないといけない.めんどくせぇ.
今日書いたコード
❯ ruby -e "File.open('multiline.txt') { |f| pp f.readlines.join }" "1\r2\n" + "3\r\n" + "4" ❯ cat multiline.txt | pbcopy
let str = """ 1 2 3 4 """ print(str) print(str.unicodeScalars.map(\.value))
1 2 3 4 [49, 10, 50, 10, 51, 10, 52]
感想
これ
Line breaks in a multiline string literal are normalized to use the line feed character. Even if your source file has a mix of carriage returns and line feeds, all of the line breaks in the string will be the same. https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID412