public class StringUtil { public static String getStringNoBlank(String str) { if(str!=null && !"".equals(str)) { Pattern p = Pattern.compile("\\s*|\t|\r|\n"); Matcher m = p.matche…
一,代码. - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. //替换回车符和空格 NSString *oldStr=@" 1 2 4 "; NSLog(@"----oldStr---%@",oldStr); //去掉首尾空格 NSString *newStr=[oldStr strin…