Sunday 15 March 2015

nsstring - Finding non-spacing characters in Objective-C -


How do I check if a letter in my NSString is a non-spacing character?

For example:

  NSString * string3 = @ "A" ?? Answer ¥ à A² "; // 12345678 & lt; - only takes 8 spaces   

NSString is a length 11, but the location that actually is on it is 8

In Java, they can check the character type using the code given below:

  is a stable boolean mark (four f) {int type = Character.getType (ch); return type == character. NON_SPACING_MARK || == type character. Ansielosaisoaisaisaiaarsi || == type character. COMBINING_SPACING_MARK;}   

of about objective-c Or? Thank you for bdash.

  NSCharacterSet * characterSet = [NSCharacterSet for nonBaseCharacterSet]; (Inti = 0; string3.length> gt; i; i ++) {NSString * string = [string 3 Uppriwartk range: Ansmkerenj (i, 1)]; Ansarenj Ptrrekha = [string Simaofchractorformset: Critrsat]; if (letterRange.location! = NSNotFound) {Anselog (@ "non-base characters Set ");} and {NSLog (@" normal ");}}   

You will know which character is not in space. Another way, you can find the code below to the following non-spaces

  NSString * newString = [[string 3 Gtksiyrikritbakractors Inset: [[Anssiarsiaractorsnet Garbajhkaractorsat] Inwartedset]] to couples : @ ""];   

So for this example, the new string length is 3. That's what I'm looking for. Thanks guys.

You can use to retrieve the set of characters in Unicode Symbols category. NSCharacterSet that it provides the ability to set provides a member of the character set, and NSString ability to find special characters within a string (or No) Members of the given NSCharacterSet .

No comments:

Post a Comment