String processing of IOS: intercepting string, matching string, separating string, case conversion

1. Intercept string
NSString *string [email protected]"123456d890";
NSString *str1 = [string substringToIndex:5];// Intercept the string before subscript 5
Nslog (@ "intercepted value:% @", STR1);
 NSString *str2 = [string substringFromIndex:3];// Truncate the string after subscript 3
Nslog (@ "intercepted value:% @", STR2);
2. Matching string
Nsstring * string = @ "SD is sfsadfsdf";
NSRange range = [string rangeOfString:@"Ad"];// Matched subscript
string = [string substringWithRange:range];// Intercepts the string in the range
Nslog (@ "intercepted value:% @", string);
3. Delimited string
NSString *string [email protected]"sdfsfsfsAdfsdf";
NSArray *array = [string componentsSeparatedByString:@"A"]; // An array separated into 2 elements from character a
NSLog(@"array:%@",array); // The result is adfsfs and dfsdf

//Replace a string with a string
NSString *strUrl = [urlString stringByReplacingOccurrencesOfString:@“;" withString:@""];
//Replace a character
NSString *idCard = [Str stringByReplacingCharactersInRange:NSMakeRange(5, 6) withString:@"*****************"];
4. Letter case conversion
NSString  *str [email protected]"AAaaBB3bb";
//Convert all strings to lowercase
NSString *str1 = [str lowercaseString];
NSString * str2 = str.lowercaseString;

//Convert all strings to uppercase (including numbers)
str1 = [str uppercaseString];
str2 = str.uppercaseString;

//Uppercase at the beginning and lowercase at the rest (it contains numbers, and the letters after the numbers will be uppercase)
str1 =[str capitalizedString];
str2 =str.capitalizedString;

DLog(@"%@ - %@",str1, str2);