本文介绍了索引如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

NSString * str1 = @"Hello"; //什么是"H"的索引是0还是1?
NSString * str2 = @这是我的第二个字符串";
NSString * temp;
temp = [str1 substringToIndex:2]; //"substringToIndex"-最高索引的含义
NSLog(@"Substring-%@",temp); //2或从0到1?

NSString *str1=@"Hello"; // What is Index of ''H'' is it 0 or 1 ?
NSString *str2=@"This is my 2nd string";
NSString *temp;
temp=[str1 substringToIndex:2]; // " substringToIndex " -- what it means upto index
NSLog(@"Substring -- %@",temp); // 2 or from 0 to 1 ??

推荐答案


这篇关于索引如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 01:46