LibDeformat-3.0

This project is abandoned and its default file will likely not work with the most recent version of World of Warcraft. Whether this project is out of date or its author has marked it as abandoned, this project is no longer maintained.

This library will convert a fully-formatted text string to its original arguments given a format string.

It is essentially the opposite of string.format.

local LibDeformat = LibStub("LibDeformat-3.0")

LibDeformat("Hello, friend", "Hello, %s") => "friend"
LibDeformat("Hello, friend", "Hello, %1$s") => "friend"
LibDeformat("Cost: $100", "Cost: $%d") => 100 -- note that it converted it back to a number
LibDeformat("Cost: $100", "Cost: $%1$d") => 100
LibDeformat("Alpha, Bravo", "%s, %s") => "Alpha", "Bravo"
LibDeformat("Alpha, Bravo", "%1$s, %2$s") => "Alpha", "Bravo"
LibDeformat("Alpha, Bravo", "%2$s, %1$s") => "Bravo", "Alpha" -- this can happen in foreign languages
LibDeformat("Hello, friend", "Cost: $%d") => nil -- nil is returned when there is no match

LibDeformat-3.0 API


Comments

  • To post a comment, please or register a new account.
Posts Quoted:
Reply
Clear All Quotes

About This Project

  • Project ID
    21832
  • Created
    Jan 4, 2010
  • Last Released File
    Jan 4, 2010
  • Total Downloads
    9,220
  • License

Categories

Members

Recent Files

WoW Retail