텍스트
Whitespace & Trim Tools
불필요한 공백 정리: 줄 끝 공백 제거, 반복된 공백 축소, 빈 줄 삭제, 탭 ↔ 공백 변환.
Extra whitespace — at line edges, doubled up inside text, blank lines, mixed tabs and spaces — is rarely visible at a glance, but it often breaks string comparisons, parsing, or how code looks. This tool cleans up such issues with a set of targeted operations.
How to use it
- Trim: strip whitespace from the start and end of every line.
- Collapse: replace several consecutive spaces or blank lines with a single one.
- Tabs ↔ spaces: convert in either direction with a chosen number of spaces per tab.
Common uses
- Cleaning up text copied from a PDF or Word document, which often leaves extra spaces and invisible characters behind.
- Normalizing code indentation to one consistent style (spaces only or tabs only) before a commit.
- Debugging why two visually identical lines aren't equal when compared — often the cause is a hidden extra space or a non-breaking space.
Things to keep in mind
A non-breaking space ( , code point U+00A0) looks like a regular space but is a different character to a computer — strings containing it aren't equal to a regular space in comparisons.
Trimming line-edge whitespace doesn't touch spaces inside words or sentences — collapsing repeated internal spaces is a separate operation.
자주 묻는 질문
가장자리 공백 제거와 반복 공백 축소의 차이는 무엇인가요?
가장자리 공백 제거는 각 줄의 시작과 끝 공백만 제거하고, 반복 공백 축소는 한 줄 내 연속된 여러 공백을 가장자리는 건드리지 않고 하나의 공백으로 대체합니다.
빈 줄과 탭/공백 변환은 어떻게 처리되나요?
빈 줄을 완전히 제거하거나 연속된 빈 줄만 하나로 축소할 수 있으며, 구성 가능한 탭 너비로 탭을 공백으로 또는 그 반대로 변환할 수 있습니다.
붙여넣은 텍스트가 서버로 전송되나요?
아니요, 정리는 브라우저에서 JavaScript로 완전히 실행되며 다른 곳으로 전송되는 데이터는 없습니다.
폭이 0인 문자란 무엇인가요?
zero-width space, zero-width joiner 등 화면에서 전혀 공간을 차지하지 않지만 텍스트 안에 독립된 문자로 존재하는 문자입니다. 특정 웹사이트에서 복사할 때 텍스트에 섞여 들어가는 경우가 있으며, 눈에 띄지 않게 문자열 비교나 검색을 망가뜨릴 수 있습니다.
줄바꿈 없는 공백(non-breaking space)은 왜 일반 공백처럼 보이는데 다르게 동작하나요?
줄바꿈 없는 공백( )은 시각적으로는 일반 공백과 동일하지만 컴퓨터에게는 다른 문자입니다 — 화면에서 똑같아 보여도 두 종류의 공백이 섞인 문자열은 비교 시 기술적으로 같지 않습니다.