1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

改行コードを含む文字列から改行コードを取り除いて一行の文字列を取得する

Posted at

タイトルどおりです
忘れがちなのでメモ

let a = "hogehoge\fugafuga"

このような文字列をもつ定数があったとしてこれを二行から改行コード(\n)を取り除いて一行の文字列に変換します

// 改行コードを取り除いて、取り除いた後にくっつけて一行にする
a.dfdfa.components(separatedBy: .newlines).joined()

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?