English 中文(简体)
目标c与我的单char一样?
原标题:Objective c doesn t like my unichars?

在我试图做以下工作时,X条对“多功能特性”提出投诉:

static unichar accent characters[] = {  ā ,  á ,  ă ,  à  };

你们怎样做一系列的品格,如果不是全部的话? 以下著作只是罚款。

static unichar accent[] = {  a ,  b ,  c  }; 

Workaround

我所发现的最近一点工作是将特殊性质转化为黑手,即这项工作:

static unichar accent characters[] = { 0x0100, 0x0101, 0x0102 };
最佳回答

它并不像目标C那样,而是指C。 固定<代码>c为char/code>,其中1为按字母顺序排列,而不是unichar>/code>,其中2为斜体。 (详见下文说明)

代表<代码>unchar/code>的不变方式没有得到充分支持。 你们可以使用

char* s="ü";

在UTF-8-encoded的源文档中获取单代码C-string,或

NSString* s=@"ü";

载于UTF-8号编码源文档,以获取NSString。 (这在10.5之前是不可能的。) 缩略语

code>。

最后两项评论:

Note: For arcane historical reasons, a is an int in C, see the discussions here. In C++, it s a char. But it doesn t change the fact that writing more than one byte inside ... is implementation-defined and not recommended. For example, see ISO C Standard 6.4.4.10. However, it was common in classic Mac OS to write the four-letter code enclosed in single quotes, like APPL . But that s another story...

另一复杂因素是,附标信函并不总是由1份逐条代理;这取决于编码。 在UTF-8,它不是这样。 在ISO-8859-1中,它就是这样。 <代码>unichar/code>应为UTF-16。 你们是否拯救了UTF-16的源代码? 我认为,XCode的缺席是UTF-8。 海湾合作委员会也可以根据设置进行一些编码转换。

问题回答

或者你可以这样做:

static unichar accent characters[] = { L ā , L á , L ă , L à  };

L是标准的关键词,它说“要写一个UNICODE的特性或特性。

对目标C的工程罚款。

注:汇编者可向您发出过于宽松的警告,说明在座标内的性质,但你可以安全地无视这一警告。 X条码仅处理单条编码的正确方式,但汇编者将其适当分类,结果为科索沃。

视你的情况,这可能是这样做的简陋方式:

NSCharacterSet* accents = 
    [NSCharacterSet characterSetWithCharactersInString:@"āáăà"];

那么,如果你想要检查某一char是否是这些cent的特性之一:

if ([accents characterIsMember:someOtherUnichar])
{
}

<代码>NSString还有多种处理方法:NSCharacterSet





相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签