Add quotation at the start and end of each line

From LemonWiki共筆
Revision as of 14:42, 20 February 2022 by Unknown user (talk) (Created page with "將每行的文字,都加上引號框起來,並且移除換行 <pre> // before Elmo Emie Granny Bird // after 'Elmo', 'Emie', 'Granny Bird' </pre> == Add quotation at t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

將每行的文字,都加上引號框起來,並且移除換行

// before
Elmo
Emie
Granny Bird

// after
'Elmo', 'Emie', 'Granny Bird'

Add quotation at the start and end of each line

Using Notepad++[1] or sublime text

  • Find what: (.*)
  • Replace with: '\1',
    (如果要使用雙引號框起來,則是 Replace with: "\1")

Add quotation at the start and end of each line, remove return symbol & add comma symbol

Data condition 1: Trim whitespace of each line

方法1: 使用 Sublime TextNotepad++EmEditor。該方法有處理每行的前面或後面可能有一格或多格空白

如果使用 macOS icon_os_mac.png 作業系統

  • Find what: (\S+)(\s?)+$\n
  • Replace with: '\1',
    (如果要使用雙引號框起來,則是 Replace with: "\1", )

如果使用 Win Os windows.png 作業系統,需要修改換行符號 \n\r\n

  • Find what: (\S+)(\s?)+$\r\n on macOS icon_os_mac.png
  • Replace with: '\1',
    (如果要使用雙引號框起來,則是 Replace with: "\1", )

Data condition 2: Not trim whitespace of each line

方法2: 使用 Sublime Text 或 EmEditor Icon_exclaim.gif 該方法沒有處理每行的後面可能有一格或多格空白

  • Find what: (.*)$\n(\S+)$\n(\S+)\n
  • Replace with: '\1',


References