objective-c - 如何从 Cocoa 中的 CFStringTokenizer 获取 token 类型?

标签 objective-c cocoa string core-foundation

CFStringTokenizer 文档在 CFStringTokenizerAdvanceToNextToken() 中有两个相互冲突的语句:

CFStringTokenizerAdvanceToNextToken

...

Return Value

The type of the token if the tokenizer succeeded in finding a token and setting it as current token. Returns kCFStringTokenizerTokenNone if the tokenizer failed to find a token. For possible values, see “Token Types.”

...

If a token is found, it is set as the current token and the function returns true; otherwise the current token is invalidates and the function returns false.

第一段(返回标记类型)是我想看到的:例如,它可以让您检查标记是否完全由非字母数字字符组成。然而,第二段(返回 true 或 false)似乎是实际发生的情况。

有什么想法为什么会这样,或者如何解决它吗?

最佳答案

标题注释没有提到返回 true 或 false,当标题和在线文档不一致时,通常标题是正确的。

在一个简单的测试中,我能够得到除 0 和 1 之外的返回值,因此您遇到的问题可能更具体;您可以发布失败的示例代码吗?

关于objective-c - 如何从 Cocoa 中的 CFStringTokenizer 获取 token 类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/842211/

相关文章:

objective-c - 对象请求失败 : Underlying HTTP request operation failed with error: Error Domain=NSURLErrorDomain Code=-1012 "

objective-c - iPad 上不规则形状的模态视图

objective-c - 使用 Cocoa 的可扩展服务器

objective-c - 我的 NSBezierPath 在 NSCFTimer 中发生变化

php 用中间的连字符组合变量

ios - UIButton 的 setFont 已弃用,我尝试了新方法但仍然失败

objective-c - Objective-C/Cocoa 中的基本问题(类型推断还是其他什么?)

objective-c - NSMutableDictionary keyEnumerator 还是 NSArray?

JavaScript Jquery : extract string from value and compose URL with this string

python - 有没有更好的方法来交换没有占位符的字符串