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>strcenter() - center a string within <nn> spaces</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Name:     strcenter() - center a string within <nn> spaces
  Usage:    <string> = strcenter(<string>,[<width>],[<fill>])
  Params:   string <string> - the string to center
            integer <width> - the width to center within - optional,
            if left off, then the width of the current video screen
            is used. If <width> is less than the length of <string>,
            then the string is truncated at both ends in order to
            center it into <width>.
            char <fill> - the character to use to fill in all
            leading and trailing spaces - optional, if left off,
            then the default is spaces.

  Returns:  a string equal to <string>  with enough leading and
            trailing spaces, or <fill> characters to center <string>
            within <width> spaces.

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

                 ? strcenter("EOM REPORT",20)
                 * prints "     EOM REPORT     "

                 ? strcenter("EOM REPORT",20,"*")
                 * prints "*****EOM REPORT*****"

                 ? strcenter("EOM REPORT",2)
                 * prints "RE"

                 ? strcenter("EOM REPORT",6)
                 * prints "M REPO"

  Note:     Strcenter() is different then center() in that it pads
            the string on both ends to center it, whereas center()
            only pads the front of the string to center it.


See Also: center() leadchar() trailchar() rjust() ljust()

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