Text UtilitiesLesson 122Free preview
Tabs to Spaces
This lesson is part of Web Developer Tools · All levels
Summary
Tabs to spaces convert the tab character into a number of spaces according to the width chosen, usually 2, 4, or 8. Conversion makes the indexing appear consistent across different editors, terminals, and systems. For text that aligns in a column, the width of the tab needs to be carefully calculated. The consistency of the arrangements in a project is more important than choosing a certain number.
Key points
- One tab can be displayed with different widths in each application
- The basic conversion replaces each tab with N spaces
- Column ordering requires tab stop calculation
- Many editors have the option to insert spaces for tabs
- Pick one indentation style and apply it consistently
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.