An NSCharacterSet object represents a set of Unicode-compliant characters. NSString and NSScanner objects use NSCharacterSet objects to group characters together for searching operations, so that they can find any of a particular set of characters during a search. The cluster’s two public classes, NSCharacterSet and NSMutableCharacterSet, declare the programmatic interface for static and dynamic character sets, respectively.
Questions tagged [nscharacterset]
102 questions
0
votes
1 answer
How to solve Chinese character display in MySQL?
after Mysql installation , I create a table and add some records like this
create table score (
student_id int,
subject varchar(10),
subject_score int
);
insert into score values (001,'数学',50),(002,'数学',60),(003,'数学',70);
and the…

LawrenceLi
- 407
- 5
- 9
0
votes
2 answers
Remove unallowed characters from NSString
I want to allow only specific characters for a string.
Here's what I've tried.
NSString *mdn = @"010-222-1111";
NSCharacterSet *allowedCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"+0123456789"];
NSString *trimmed = [mdn…

Ryan
- 4,799
- 1
- 29
- 56
0
votes
1 answer
How to check a string using AND or OR logic with NSCharacterSet
I am using Zxing library to scan the Barcodes. The result is stored in an NSString. Here I am looking into two cases:
Case:'semicolon' : If the result string contains semicolon character....then store it in Semicolon Array
myWords_semicolon…

Teja Nandamuri
- 11,045
- 6
- 57
- 109
0
votes
1 answer
trim white space and x number of characters at the end of the string
let us consider this as a string--'Wi-Fi 1234ff'
i would like to trim this as -'wifi'
removing last 6 characters, special characters and space.
what i tried is to remove space-
NSString *trimmedString = [myString…

Avis
- 505
- 4
- 14
0
votes
2 answers
NSString manipulation. Remove only date
If I have a NSString at looks like:
2-13-2014 Norway vs Canada Per 1 20-00 2
Its being parsed and the dates will change
How do I make it turn into
Norway vs Canada Per 1
In other words, drop the date and extra characters at the end.
Iv'e…

Cheese Bread
- 15
- 2
0
votes
1 answer
Exclude "@" sign from punctuationCharacterSet
I am trying to filter my attributedString this way, using this code. However, I want the rangeOfCharacterFromSet: to include all of its original values EXCEPT for the "@" sign. How would I do this?
NSRange rangeSpace = [filteredText…
user2284295
0
votes
1 answer
how to check if an alphanumeric character is entered in text filed in iOS
I am having a condition in which i want to check if there are any special characters entered in textfield.
If there are no special characters entered it should return YES. If a special character is entered in textfield a check is made to check if…

Rani
- 3,333
- 13
- 48
- 89
0
votes
1 answer
Having trouble with BOOL method
I am trying to restrict a UITextField's input to only alphanumeric characters ie. letters and numbers. I found a BOOL method implementation here on stack overflow: https://stackoverflow.com/a/16147160/3344977
So here is what I did with my code after…

user3344977
- 3,584
- 4
- 32
- 88
0
votes
1 answer
Is it possible to call "location" on rangerOfCharacterFromSet without dot notation in objective-c?
I am trying to write this without dot notation but can't figure it out:
[[textField text] rangeOfCharacterFromSet:someInstanceVar].location
I keep getting bad receiver type NSRange (aka '_struct NSRange')
Is this not possible?
Kind regards

LondonGuy
- 10,778
- 11
- 79
- 151
0
votes
1 answer
How to change CharacterSet in HDFS
I have a small Hadoop cluster version 1.1.2, while running some basic word counts on text files written in German I noticed that HDFS is not handling well special characters like ü,ö,ä etc.
Is there a way to change the CharacterSet used in HDFS…

eruh
- 11
- 2
0
votes
2 answers
How to trim a string which is having substring in "( )"?
I've a string in India(IND), now i want to trim the characters which are included in parentheses(IND). I just want "India"
I'm trying to use
- (NSString *)stringByTrimmingCharactersInSet:(NSCharacterSet *)set;
i don't know how to provide…

Akshay
- 227
- 2
- 13
0
votes
2 answers
CharacterInString not producing expected result
I have this code:
NSCharacterSet *characterSet = [NSCharacterSet characterSetWithCharactersInString:@"abcdefghijklmnopqrstuvwxyz1234567890"];
NSLog(@"character set: %i", [characterSet characterIsMember:(unichar)"a"]);
The NSLog returns 0, when I…

Andrew
- 15,935
- 28
- 121
- 203
0
votes
0 answers
Is there a way to remove the newline created between an NSMutableDictionary key/object pair when writing to a file?
I'm trying to make the entries in my NSMutableDictionary look like this when written to a file:
Track ID 686
Name Poetic Justice (Feat. Drake)
…

user2136500
- 3
- 3
0
votes
2 answers
iPhone iOS how to programmatically check for characters like ✭ ♦ (and others from this set)?
I know that both ✭star and ♦ diamond are from the ASCII extended character set. But is there some NScharacterSet available on iOS that I can use to check for characters like these programmatically?

Alex Stone
- 46,408
- 55
- 231
- 407
0
votes
1 answer
NSString method stringByTrimmingCharactersInSet: not trimming comma
I have the following code for removing extra characters from some strings representing numbers:
NSCharacterSet *charactersToKeep = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"];
NSCharacterSet *charactersToBeRemoved =…

Darren
- 10,091
- 18
- 65
- 108