I need to keep the format after replacing tabs to withespaces...
Is there a recommended way to replace the tab character with white spaces in order to save the original format ?
Rephrasing the question would be... how many spaces does a Tab character involves? I guess it is not always the same number though...
tab character to whitespaces
Moderator: General Moderators
Re: tab character to whitespaces
That is correct and therefore the answer to your question is: it dependsjulian_lp wrote:I guess it is not always the same number though...
Ya, it depends, but I think in most cases it's 4. I've only ever seen 4 & 2 as defaults in programs.
Probably the easiest way to do it would be:
Probably the easiest way to do it would be:
Code: Select all
$new_format = str_replace("\t",' ',$old_format);Real programmers don't comment their code. If it was hard to write, it should be hard to understand.