V
V
virtualhero2017-07-22 09:35:14
JavaScript
virtualhero, 2017-07-22 09:35:14

How to encode tab character?

How can tab characters be encoded? For example: I am writing a parser for app.css files and I need to format the code so that it can be edited later (this is just an example).
For example, here is what happens with the selector and its property:

css += '.my-class ' + "{\n";
css += prop + ': ' + val + ";\n";
css += "}\n";

at the exit:
.my-class {
display: none;
}

How can I encode tab characters, for example I want to make a tab into 4 spaces, how can I do this in the code instead of directly entering a tab in a line?
you need the output to be a tab stop:
.my-class {
  display: none;
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question