Quantcast ESOUI - View Single Post - Singular & plural form using the zo_strformat() function
View Single Post
05/09/14, 10:42 AM  
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 853
There are also other control characters, but without documentation is hard to say if I got them all and if it is correct:

a: - adds indefinite article in correct form ("a/an") if string is not name (does not contain ^M,^F,^N). If used with m (<<ma:1>>) it will add "some".
A: - adds definite article if string is not name (does not contain ^M,^F,^N)
c: - converts first character to lower case
C: - converts first character to upper case, used to display names
d: - demonstrative pronoun, adds "this" if string is not name (does not contain ^M,^F,^N)
D: - returns demonstrative pronoun
g: - adds " of a", if string is name it will add to the end "'s" for singular, "'" for plural
G: - adds " of the" if string is name it will add to the end "'s" for singular, nothing for plural
i: - changes number to index (1st,2nd,3rd,....100th)
I: - the same as above?
l: - adds "at the ", used with locations
L: - adds "to the ", used with locations
m: - multiplication, displays singular or plural accoding to the second argument. If you have number on any other position, this will not work.
n: - number to text (one, two, three, ..., twelve). Does not work for numbers higher then 12.
N: - same as above, just first letter is capital (One,Two,...)
o: - possessive pronoun (subject). Returns his, her, its according to the ^m, ^f, ^n on the end of string
O: - possessive pronoun (object). Returns his, hers, its.
p: - personal pronoun (subject). Returns he, she, it accoding to the ^m, ^f, ^n on the end of string
P: - personal pronoun (object). Returns him, her, it.
r: - reflexive pronoun. Returns himself, herself, itself accoding to the ^m, ^f, ^n on the end of string
R: - number to roman numerals.
t: - converts first letter to upper case in all words that have more than 1 character (used by default to format item links)
T: - converts first letter to upper case in all words (including single letter words)
x: - changes link to plain text (EDIT: as of Update 3 this doesn't work)
X: - raw format (probably, it does not remove ^ control chars from strings, links are unchanged.)
z: - converts text to lower case letters, works for special characters like etc.
Z: - converts text to upper case letters, works for special characters like etc.

- control characters are used in form <<Z:1>> or <<1{Z}>>
- instead of <<2>><<m:1>> can be used simplified form <<2*1>>

Almost all control charactes can be used together, so:
zo_strformat("<<C:1>> <<2>> <<tm:3>>", "i have", 10, "blue colored item")
will return "I have 10 Blue Colored Items"

If you want to work with translations, there are a few control characters that you can add to the end of string:
^f - femine gender
^F - femine name
^m - masculine gender
^M - masculine name
^n - neuter gender
^N - neuter name
^p - plural
^P - plural name

Example:
zo_strformat("<<g:1>><<2>>", "Peter^M", "item")
returns "Peter's item"
__________________
@Garkin (retired from ESO)
My addons: SkyShards, LoreBooks, Dustman, Map Coordinates, No, thank you!, ... (full list)

Last edited by Garkin : 01/24/15 at 06:33 AM. Reason: Updated x:
  Reply With Quote