
FORMAT_STRING(2)           silmul_efun          FORMAT_STRING(2)

名稱
     format_string - 比 sprintf 快速的格式化字串輸出

語法
     string format_string (string format, mixed *variables);

描述
     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.

     例子

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

作者
     Ichabod@TMI, 2/4/93
     wade@future 4/7/1996 翻譯

MudOS Release 0.9         Last change:                   3-19-93

