Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FUNCky - <b>name:</b> <b>tabexpand() - expand tabs to correct tab stops</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Name:     tabexpand() - expand tabs to correct tab stops
  Usage:    <string> = tabexpand(<string>,[<width>])
  Params:   string <string> - the string to scan
            integer <width> - the number of spaces between tabs,
            optional - if left off, then the default is 8 spaces
  Returns:  a string equal to <string> with all tabs expanded by
            <width> spaces so that each tab aligns at the next
            correct tab position.

            tabexpand() does not just insert the number of spaces
            you specify whenever it encounters a tab character. It
            calculates the current position of the tab character,
            finds out where the position of the next tab would be
            if each tab were at <width> characters, and then it
            calculates the correct number of spaces to insert in
            order to place the tab character at the next correct tab
            position.

 ---------------------------------- Example ---------------------------------

                 han1 = fopen("edit.prg")
                 han2 = fcreate("edit2.prg")

                 do while .not. feof(han1)
                    fwriteline(han2,tabexpand(freadline(han1)))
                 enddo

                 fclose(han1)
                 fclose(han2)

            This example creates a file called edit2.prg that is the
            same as edit.prg except that all tab characters have been
            replaced with the proper number of spaces to expand the
            tabs.


See Also: strexpand() strextract() chrswap() chrcount()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson