zoukankan      html  css  js  c++  java
  • stringByAppendingPathComponent、stringByAppendingString等语句的区别

    NSString *a1=@"Hello";
    NSString *a2=@"World";
     
    NSString *and1=[a1 stringByAppendingString:a2];
    NSString *and2=[a1 stringByAppendingPathComponent:a2];//Append附加,path路径,component组成
    NSString *and3=[a1 stringByAppendingPathExtension:a2];//extension扩大,延长(扩展名)
    NSString *and4=[a1 stringByAppendingFormat:@"_123456_%@",a2];//format格式
      
    NSLog(@"%@",and1);
    NSLog(@"%@",and2);
    NSLog(@"%@",and3);
    NSLog(@"%@",and4);
    /*******************************/
    2015-11-05 20:52:12.500 test[10068:192356] HelloWorld
    2015-11-05 20:52:12.501 test[10068:192356] Hello/World
    2015-11-05 20:52:12.501 test[10068:192356] Hello.World
    2015-11-05 20:52:12.502 test[10068:192356] Hello_123456_World
    /*******************************/
     
  • 相关阅读:
    《研磨设计模式》阅读摘要
    心电图
    nodejs
    自动化测试
    Hook技术
    热修复原理
    理解ClassLoader
    Dalvik和ART
    Java虚拟机
    理解WindowManagerService
  • 原文地址:https://www.cnblogs.com/liuyingjie/p/4940948.html
Copyright © 2011-2022 走看看