Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 在目标c中,如何将数字和字符拆分为两个字符串?_Iphone_Objective C_String - Fatal编程技术网

Iphone 在目标c中,如何将数字和字符拆分为两个字符串?

Iphone 在目标c中,如何将数字和字符拆分为两个字符串?,iphone,objective-c,string,Iphone,Objective C,String,我想使用Objective C将类似FG12344的字符串拆分为FG和12344。我不知道如何执行此操作,请在此问题上帮助我?有关字符: NSString *characters = [@"FG12344" stringByTrimmingCharactersInSet:[NSCharacterSet decimalDigitCharacterSet]]; 有关数字: NSString *numbers = [@"FG12344" stringByTrimmingCharactersInSet

我想使用Objective C将类似FG12344的字符串拆分为FG和12344。我不知道如何执行此操作,请在此问题上帮助我?

有关字符:

NSString *characters = [@"FG12344" stringByTrimmingCharactersInSet:[NSCharacterSet decimalDigitCharacterSet]];
有关数字:

NSString *numbers = [@"FG12344" stringByTrimmingCharactersInSet:[NSCharacterSet letterCharacterSet]];

您可以在类似情况下使用NSPredicate。

什么是浮点数?i、 e.1234.56英尺。它应该是[NSCharacterSet-letterCharacterSet],我认为这将处理整数和浮点数。是的@cspam,[NSCharacterSet-letterCharacterSet]将允许您使用整数或浮点数。