It is my understanding that iOS uses ICU under the hood. I'd like to access the functionality of ICU's MessageFormat for strings involving numbers and plurals, for example,
There {0,choice,0#are no files|1#is one file|1<are {0,number,integer} files}.
Does iOS expose this capability? If so how do I use it? I thought I might be able to write
[NSString stringWithFormat: "There {0,choice,0#are no files|1#is one file|1<are {0,number,integer} files}.", n];
or
[NSString stringWithFormat: "There {0,plural, =0{are no files}=1{is one file}other{are %ld files}}.", n];
But these formats (ICU4J and ICU, respectively) do not work.
No comments:
Post a Comment