yoshida Posted January 10, 2007 Share Posted January 10, 2007 Currently I'm writing a script manager to use one website as an editor for my central script library, and I'm wondering how I'm going to str_replace a tab to an empty space of equivalent width (and back). Any suggestions?Help appreciated. Link to comment Share on other sites More sharing options...
justsomeguy Posted January 10, 2007 Share Posted January 10, 2007 You need to determine how big you want a tab to be. It's machine and application-dependent. Word might show a tab as 8 spaces, and notepad might show it as 5. So the first thing is to determine how big you want a tab to be. $tab_to_spaces = " "; #5 spaces$new_str = str_replace("\t", $tab_to_spaces, $old_str); #convert tabs to spaces$new_str = str_replace($tab_to_spaces, "\t", $old_str); #spaces to tabs Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now