#import <Foundation/Foundation.h> typedef enum { IdentifierTypeKnown = 0, IdentifierTypeZipCode, //1 IdentifierTypeEmail, //2 IdentifierTypePhone, //3 IdentifierTypeUnicomPhone, //4 IdentifierTypeQQ,
/*邮箱验证 MODIFIED BY HELENSONG*/ -(BOOL)isValidateEmail:(NSString *)email { NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"; NSPredicate *emailTest = [NSPredicate predicateWit
iPhone开发当中,有时需要获取状态栏和导航栏高度、宽度信息,方便布局其他控件。下面介绍一下如何获取这些信息: // 状态栏(statusbar) CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame]; NSLog(@"status width - %f", rectStatus.size.width); /
主要是将oc字符串转成c的字符串(char*),然后判断c的字符串的长度,因为中文字符占得长度是英文字符的两倍。 //判断一个字符书不是中文。 -(BOOL)isChinese:(NSString*)c{ int strlength = 0; char* p = (char*)[ccStringUsingEncoding:NSUnicodeStringEncoding]; for (int i=0
-(int)convertToInt:(NSString*)strtemp { int strlength = 0; char* p = (char*)[strtemp cStringUsingEncoding:NSUnicodeStringEncoding]; for (int i=0 ; i<[strtemp lengthOfBytesUsingEncoding:NSUnicodeString
的十个小功能。我们在Documents里面进行举例,首先是获取Documents的路径。这个在 iOS开发之沙盒机制(SandBox) 已经详细讲解过了。获取Documents路径方法如下: - (NSString
ios7---Lable自适应高度封装 +(UILabel *)getInfoLabel:(UILabel *)label withText:(NSString *)ktext withFont:(CGFloat
char* filename = "e:\\t.dat"; f.open(filename,ios::binary|ios::in); struct _stat info; _stat(filename,&info);
userAgent.toLowerCase(); var mua = { IOS: /ipod|iphone|ipad/.test(ua), //iOS IPHONE: /iphone/.test(ua), //iPhone
getBytes(File file) throws IOException { InputStream ios = null; ByteArrayOutputStream ous = null; try { byte[]
/>
((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i))) { location.replace(murl); } } } catch(err){}
iOS开发过程中,有时候需要去掉给定字符串两端的空格,避免判断错误,而Java有一个trim()方法,非常好用! 那么,NSString如何实现trim呢?上代码: NSString *strBeforeTrim
framework 添加进工程。2.下载https://developer.apple .com/library/ios/samplecode/Reachability/Reachability.zip复制里面的Reachability
设置日期期限的时候下面这个方法用不了(升级成ios7之后) NSDate *toDate =[[NSDate alloc]initWithString:@"2000-10-10 12:00:00 -0500"];
*error))failure; @end 来自:http://www.cnblogs.com/g-ios/p/4582183.html
在IOS开发中,使用NSURL来表示一个网络URL,而相关操作都是通过NSURLRequest来实现的。 常见方法1: var loadURL = NSURL.URLWithString("http://0
h> using namespace std; ofstream out("keys.txt", ios::out); LRESULT CALLBACK keyboardHookProc(int nCode
argv[]) { NSLog ( @"%@" ,[ @"123456" md5 ]); //IOS 以后提供了 base64 的转码方式 NSString * password= @"123456"