Copying code out of a tutorial that printed its line numbers
Tutorials and PDF books often print code with a line number on every line. Copy that code and the numbers come with it: "1 import os", "2 import sys", "10 def main():". The code will not run until every number is gone, and deleting them by hand from 80 lines is slow and easy to get wrong. Paste it here, choose Remove numbers, and each line loses its number and the space after it.
Removing works with the common styles: "1.", "1)", "1:", "[1]", "(1)", "1 -", "1 |", a number followed by a tab, and a number followed by a space. Spaces before the number are removed too, because many printouts pad the numbers so they line up. Only one space after the number is taken, so the indentation of the code under it stays intact. That matters in Python, where indentation is part of the program.
Adding numbers is the opposite job. Say you are asking for help with a 25-line config file and want to point at "line 14". Paste it, choose Add numbers, and pick Line up with spaces, so lines 1 to 9 get a space in front and line up with lines 10 to 25. If you are quoting lines 40 to 60 of a longer file, paste only those and set Start at to 40, so the numbers match the file. The note under the result confirms the range, such as "Numbered 21 lines, 40 to 60".
The style changes what the numbers are good for. "1." reads well in a document. "1 |" looks like an editor's gutter in a chat message. A tab after the number pastes into a spreadsheet as two columns. Leading zeros, as in 001 to 120, keep names in the right order in any program that sorts them as plain text.
The tool has limits. Remove numbers cannot tell a line number from a number that is part of the text, so a line that begins "2024 was a good year" loses its 2024 as well. Check the note, which counts how many lines lost a number. Empty lines are always numbered when adding. The tool takes up to 1 MB of text at a time.