如何从原始字符串中删除字符串
即我的字符串是,
series0001.0001
or
series0010.0101
or
series0110.0050
从这个字符串我必须将它转换为
expected result
Series 1 1
Series 10 101
Series 110 50
这是我正在做的代码
NSArray * words = [sym.data componentsSeparatedByString:@"\r\n\r\n"];
NSLog(@"words are %@",words);
NSString *strSeriesAndLabelDetail = [words objectAtIndex:0];
NSLog(@"strSeriesAndLabelDetail is %@",strSeriesAndLabelDetail);
NSArray *wordsToSeparateSeriesAndLabel = [strSeriesAndLabelDetail componentsSeparatedByString:@"."];
NSLog(@"wordsSeriesLabel are %@",wordsToSeparateSeriesAndLabel);
strLabelNumber = [wordsToSeparateSeriesAndLabel objectAtIndex:1];
NSLog(@"strLabelNumber are %@",strLabelNumber);
strSeriesNumber = [wordsToSeparateSeriesAndLabel objectAtIndex:0];
NSLog(@"strSeriesNumber is %@",strSeriesNumber);
当前输出为:
words are (
"series0001.0003",
"Use the Sort-a-Cord app to read this code or visit www.sortacord.com to get your Sort-a-Cords."
)
strSeriesAndLabelDetail is series0001.0003
wordsSeriesLabel are (
series0001,
0003
)
strLabelNumber are 0003
strSeriesNumber is series0001
谁能帮帮我。提前感谢您的任何建议。