X-Git-Url: http://git.pk910.de/?p=phpgitweb.git;a=blobdiff_plain;f=htdocs%2Flib%2FTools.class.php;fp=htdocs%2Flib%2FTools.class.php;h=7e02c68e90406d60be7dabbd829e66de8a17ec59;hp=c0b01b0cd15b406e931145b479073f44b3b0589b;hb=07f0862d6ef4a14a812381a30931a46a51dbc87d;hpb=5a1b314c0a0ab8ed9be7b857c7996d8a3f87e7ed diff --git a/htdocs/lib/Tools.class.php b/htdocs/lib/Tools.class.php index c0b01b0..7e02c68 100644 --- a/htdocs/lib/Tools.class.php +++ b/htdocs/lib/Tools.class.php @@ -128,6 +128,19 @@ class Tools { return $offset; } + public static function replaceTabs($line) { + while(($pos = strpos($line, "\t")) !== false) { + $spacecount = 8 - ($pos % 8); + $i = 1; + while($line[$pos + $i] == "\t") { //maybe a little bit faster ;) + $i++; + $spacecount += 8; + } + $line = substr($line, 0, $pos).str_repeat(' ', $spacecount).substr($line, $pos + $i); + } + return $line; + } + } ?> \ No newline at end of file