常用编程语法干货

汇总一下最近用到过的语法,首先声明我对Bash和Object-C语言用的不多,只是日常积累。

Bash if or and 语法

if [ "$ifcentos" != "" ] && [ "$machine" == "x86_64" ];thensed -i 's/^#exclude/exclude/' /etc/yum.conffiif [ "$ifubuntu" != "" ] || [ "$ifdebian" != "" ];then   mkdir -p /var/lock   sed -i 's#exit 0#touch /var/lock/local#' /etc/rc.localelse   mkdir -p /var/lock/subsys/fi

Object-C 查找字符串是否存在

if ([string rangeOfString:substring].location == NSNotFound){          NSLog(@"Substring Not Found");}else{    NSLog(@"Substring Found Successfully");}

Object-C 获取文件夹Documents路径

NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);NSString* documentsDirectory = [paths objectAtIndex:0];

对应模拟器下的路径:

/Users/lixiphp/Library/Application Support/iPhone Simulator/7.1/Applications/XXXXXX/Documents

(…)Read the rest of 常用编程语法干货 (24 words)


© Li Xi for LixiPHP, 2014. |Permalink |No comment |Add todel.icio.usPost tags: Application, Bash, Documents, Object-C

Feed enhanced by Better Feed from Ozh

失败是成功之母

常用编程语法干货

相关文章:

你感兴趣的文章:

标签云: