PluralUtils
public final class PluralUtils
Utility class that allows SDK clients to leverage the logic used for pluralization rules.
-
For a given substitutions phrase, it returns an array with the parsed tokens.
String Catalogs (
.xcstrings
)This iPhone contains %1$#@token1@ with %2$#@token2@
The extracted tokens will be:
("%1$#@token1@", "1$", "token1")
("%2$#@token2@", "2$", "token2")
Strings Dictionary Files (
.stringsdict
)This iPhone contains %#@token1@ with %#@token2@
The extracted tokens will be:
("%#@token1@", "", "token1")
("%#@token2@", "", "token2")
Declaration
Swift
public class func extractTokens(from substitutionsPhrase: String) -> [(String, String, String)]
Parameters
substitutionsPhrase
The substitutions phrase
Return Value
The array of extracted token tuples. A tuple of three elements: The first one is the original token, the second is the exported prefix (positional specifier) and the cleaned up version of the token without the specifiers and the delimiters.