format_string.2

tmi2_fluffos_v2/lib/doc/functions/simul_efuns/format_string.2 · 1.5 KB

From the archive tmi2_fluffos_v2.zip

Download the archive   « Back to the archive contents

FORMAT_STRING(2)          SYSTEM CALLS           FORMAT_STRING(2)

NAME
     format_string - "minimal string formatting for those without
     sprintf

SYNOPSIS
     string format_string (string format, mixed *variables);

DESCRIPTION
     Given a string "format" and an array "variables" of zero  or
     more strings, format_string returns a formatted string where
     each  "%s"  in  the  "format"  string  is  replaced  by  the
     corresponding  element from "variables".  If there are fewer
     strings in the "variables" array than there are "%s" strings
     in  the "format" string, format_string will behave as though
     the missing arguments were all empty strings ("").  If there
     are  more  strings  in  the "variables" array than there are
     "%s" strings in "format", the extra strings  in  "variables"
     will be appended to the result string.

     EXAMPLES

     format_string("test%s")                   returns     "test"
     format_string("test  ",  ({  "one  }))    returns "test one"
     format_string("test %s-%s", ({ "1", "2" }))
                                           returns   "test   1-2"
     format_string("test %s-%s", ({ "1", "2", "-oops!" }))
                                           returns   "test   1-2-
     oops!" format_string("test %s-%s-%s.", ({ "1", "2" }))
                                           returns "test 1-2-."

AUTHOR
     Ichabod@TMI, 2/4/93


MudOS Release 0.9         Last change:                   3-19-93

Site Stats

Snippets: 1791
Codebases: 571