Thread Tools Display Modes
Prev Previous Post   Next Post Next
05/09/14, 05:13 AM   #1
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Singular & plural form using the zo_strformat() function

Lua Code:
  1. pattern = "I have sold <<1>> <<1[items/item/items]>>."
  2.  
  3. msg = zo_strformat(pattern, num)

If num = 0
<<1>> is replaced by num and <<1[items/item/items]>> returns first from
msg = "I have sold 0 items"

if num = 1
<<1>> is replaced by num and <<1[items/item/items]>> returns second from
msg = "I have sold 1 item"

if num > 1
<<1>> is replaced by num (eg 5) and <<1[items/item/items]>> returns third from
msg = "I have sold 5 items"
  Reply With Quote
 

ESOUI » Developer Discussions » Tutorials & Other Helpful Info » Singular & plural form using the zo_strformat() function


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off