in reply to Re: Re: How to replace Tab with spaces not altering postion
in thread How to replace Tab with spaces not altering postion
Text::Tabs will do the same as my example, it will replace the tabs with a fixed amount of spaces but it will not consider the spaces in between the two strings.
i disagree. from the description in the Text::Tabs pod:
Text::Tabs does about what the unix utilities expand(1) and unexpand(1) do. Given a line with tabs in it, expand will replace the tabs with the appropriate number of spaces. Given a line with or without tabs in it, unexpand will add tabs when it can save bytes by doing so. Invisible compression with plain ascii!
here's an example:
#!/usr/bin/perl require 5.006_001; use strict; use warnings; $|++; use Text::Tabs; my $tabstop = 8; my $text = "12345678901234567890\n\thi\tbye"; print $text,$/,length $text,$/; my $newtext = expand($text) print $newtext, $/,length $newtext,$/; __END__ ## prints 12345678901234567890 hi bye 28 12345678901234567890 hi bye 40
...unless i'm missing something
~Particle *accelerates*
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re^3: How to replace Tab with spaces not altering postion
by juo (Curate) on Oct 09, 2002 at 16:46 UTC | |
by BrowserUk (Patriarch) on Oct 09, 2002 at 18:42 UTC | |
by juo (Curate) on Oct 09, 2002 at 19:15 UTC | |
by BrowserUk (Patriarch) on Oct 09, 2002 at 19:00 UTC |