ios - 拼出序数
<p><p>使用 <code>NSNumberFormatter</code>(来自 iOS 9)或 3rd 方(如 <code>FormatterKit</code>)生成短序数(如“1st”、“2nd”等)的方法很少。 </p>
<p>还有一种方法可以用 <code>NSNumberFormatter</code> 拼出基数,给出 <code>one</code>、<code>two</code>、<code>three</code> .</p>
<p>但是,我需要得到未缩写的拼写 - <code>first</code>、<code>second</code>、<code>third</code>。 </p>
<p>我知道 iOS 内部可以做到这一点,因为如果我将“1st”传递给 <code>AVSpeechUtterance</code>,它会将其发音为“first”。我想知道是否有任何 API 可以获取带有序数拼写的字符串,最好是针对多种语言?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我找不到现有的库,所以我创建了自己的。</p>
<p>它使用系统库中的 ICU4C。使用前请先查看示例项目的工作原理:</p>
<p> <a href="https://github.com/dimat/DMNumberSpellOutFormatter" rel="noreferrer noopener nofollow">https://github.com/dimat/DMNumberSpellOutFormatter</a> </p></p>
<p style="font-size: 20px;">关于ios - 拼出序数,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/41805206/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/41805206/
</a>
</p>
页:
[1]