当前位置:网站首页>Objective-C string class, array class
Objective-C string class, array class
2022-07-04 03:34:00 【Zyryck】
String class :
NSString* str1 = @"dancer";
NSString* str2 = [[NSString alloc] initWithFormat:@"%d beijing",1949];
NSString* str3 = [NSString stringWithFormat:@"%ld beijing",1948];
NSUInteger len = str1.length;
// Calculate the length
// notes : One Chinese character and one length
NSLog(@"%lu",len);
// More equal
BOOL result = [str1 isEqualTo:str2];
if(result){
NSLog(@" equal ");
}else{
NSLog(@" It's not equal ");
}
Array class :
//NSMutableArray Variable array
NSMutableArray* array = [[NSMutableArray alloc]init];
// Arrays can hold objects of any type
// Additions and deletions
[array addObject:@"obj1"];
// Delete by object
[array removeObject:@"obj1"];
// Delete... By index
[array removeObjectAtIndex:0];
// Accessing array elements
NSString* item1 = array[0];
边栏推荐
- WordPress collection WordPress hang up collection plug-in
- Tsinghua University product: penalty gradient norm improves generalization of deep learning model
- Setting methods, usage methods and common usage scenarios of environment variables in postman
- super_ Subclass object memory structure_ Inheritance tree traceability
- Code Execution Vulnerability - no alphanumeric rce create_ function()
- How to pipe several commands in Go?
- what does ctrl + d do?
- PHP database connection succeeded, but data cannot be inserted
- Eh, the log time of MySQL server is less than 8h?
- [Valentine's Day confession code] - Valentine's Day is approaching, and more than 10 romantic love effects are given to the one you love
猜你喜欢
WP collection plug-in free WordPress collection hang up plug-in
Tsinghua University product: penalty gradient norm improves generalization of deep learning model
Li Chuang EDA learning notes 13: electrical network for drawing schematic diagram
Cache general management class + cache httpcontext Current. Cache and httpruntime Differences between caches
Consul of distributed service registration discovery and unified configuration management
Setting methods, usage methods and common usage scenarios of environment variables in postman
What is cloud primordial?
How to use websocket to realize simple chat function in C #
Unity controls the selection of the previous and next characters
微信公众号网页授权
随机推荐
I stepped on a foundation pit today
(column 23) typical C language problem: find the minimum common multiple and maximum common divisor of two numbers. (two solutions)
Have you entered the workplace since the first 00???
Base d'apprentissage de la machine: sélection de fonctionnalités avec lasso
【.NET+MQTT】.NET6 環境下實現MQTT通信,以及服務端、客戶端的雙邊消息訂閱與發布的代碼演示
Zigzag scan
JS object definition
Unity writes a character controller. The mouse controls the screen to shake and the mouse controls the shooting
Explain AI accelerator in detail: why is this the golden age of AI accelerator?
Solve the problems encountered by the laravel framework using mongodb
Dare to climb here, you're not far from prison, reptile reverse actual combat case
Future源碼一觀-JUC系列
Handler source code analysis
Zhihu million hot discussion: why can we only rely on job hopping for salary increase? Bosses would rather hire outsiders with a high salary than get a raise?
Hospital network planning and design document based on GLBP protocol + application form + task statement + opening report + interim examination + literature review + PPT + weekly progress + network to
150 ppt! The most complete "fair perception machine learning and data mining" tutorial, Dr. AIST Toshihiro kamishima, Japan
Love and self-discipline and strive to live a core life
warning: LF will be replaced by CRLF in XXXXXX
Typical applications of minimum spanning tree
What is cloud primordial?