barriers / 阅读 / 详情

微信公众平台JS 复制粘贴代码问题,为什么微信上面不能用?在手机浏览器上面都行

2023-07-27 06:25:06
共2条回复
瑞瑞爱吃桃

微信浏览器感觉对JS支持不是很好,而且还屏蔽了挺多其他功能。

我之前微信浏览器打开淘宝触屏版查看宝贝时候图片幻灯片就有问题,而且图片加载也异常。

meira

这种问题我们也经常遇到,最近在测试一些微信功能,也发现了在微信浏览器和手机浏览器之间的一些问题,微信浏览器主要是针对微信的,很多js都不支持,不过我们都通过其他的办法解决了,你可以选择另外的方式,找另外的方法。

相关推荐

objective-c怎么将一个字符串分割成多个字符串

可以用NSString类的 - (NSArray *)componentsSeparatedByString:(NSString *)separator函数实现。例子:假如有一个字符串NSString *list = @"Karin, Carrie, David";可以用上面的函数得到一个字符串数组:NSArray *listItems = [list componentsSeparatedByString:@", "];这个数组就是把原来的字符串用","分割得到的多个字符串:{ @"Karin", @"Carrie", @"David"" }下面是苹果官方NSString类的说明:链接地址:https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/index.html#//apple_ref/occ/instm/NSString/componentsSeparatedByString:Objective-C - (NSArray *)componentsSeparatedByString:(NSString *)separatorParametersseparatorThe separator string.Return Value An NSArray object containing substrings from the receiver that have been divided by separator.Discussion The substrings in the array appear in the order they did in the receiver. Adjacent occurrences of the separator string produce empty strings in the result. Similarly, if the string begins or ends with the separator, the first or last substring, respectively, is empty. For example, this code fragment:NSString *list = @"Karin, Carrie, David";NSArray *listItems = [list componentsSeparatedByString:@", "];produces an array { @"Karin", @"Carrie", @"David"" }. If list begins with a comma and space—for example, @", Norman, Stanley, Fletcher"—the array has these contents: { @"", @"Norman", @"Stanley", @"Fletcher" } If list has no separators—for example, "Karin"—the array contains the string itself, in this case { @"Karin" }.
2023-07-25 23:09:231

ios开发创建多个字符串简写

创建字符串C中用”” 表示字符串,OC中用@”” 表示字符串;打印C字符串用%s,打印OC字符串用%@。①字面量方法(常量赋值)NSString * str1 = @"春风十里不如你";NSLog(@"字面量赋值:%@",str1);1212②实例化方法(对象方法)NSString * str2 = [[NSString alloc] initWithString:@"再别康桥"];NSLog(@"实例方法:%@",str2);
2023-07-25 23:09:312

IOS中有一个不定长度字符串,但是如何获取空格后面的字符串?如:abc ak123

- (NSArray *)componentsSeparatedByString:(NSString *)separator;这个方法是:根据你选定的NSString(separator)分割符来拆分你想要拆分的字符串。就是[@"abc ak123" componentsSeparatedByString:@" " ];分割之后是一个数组,你需要那一部分就取哪一部分。
2023-07-25 23:09:381

ios 为什么 分隔componentsseparatedbystring

那个是换行标示符 学计算机的童鞋都懂
2023-07-25 23:09:452

ios开发有没有方法进行字符串排序

普通的NSArray本身就有进行排序的方法,sort...方法, NSArray *ar; [ar sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) { // 处理比较业务逻辑 }]
2023-07-25 23:09:522

怎么判断两个时间的时间差ios开发

计算两个时间差的两个函数 两个时间之差- (NSString *)intervalFromLastDate: (NSString *) dateString1 toTheDate:(NSString *) dateString2{ NSArray *timeArray1=[dateString1 componentsSeparatedByString:@"."]; dateString1=[timeArray1 objectAtIndex:0];NSArray *timeArray2=[dateString2 componentsSeparatedByString:@"."]; dateString2=[timeArray2 objectAtIndex:0]; NSLog(@"%@.....%@",dateString1,dateString2); NSDateFormatter *date=[[NSDateFormatter alloc] init]; [date setDateFormat:@"yyyy-MM-dd HH:mm:ss"];NSDate *d1=[date dateFromString:dateString1]; NSTimeInterval late1=[d1 timeIntervalSince1970]*1;NSDate *d2=[date dateFromString:dateString2]; NSTimeInterval late2=[d2 timeIntervalSince1970]*1;NSTimeInterval cha=late2-late1; NSString *timeString=@""; NSString *house=@""; NSString *min=@""; NSString *sen=@""; sen = [NSString stringWithFormat:@"%d", (int)cha%60]; // min = [min substringToIndex:min.length-7];// 秒 sen=[NSString stringWithFormat:@"%@", sen];min = [NSString stringWithFormat:@"%d", (int)cha/60%60];// min = [min substringToIndex:min.length-7];// 分 min=[NSString stringWithFormat:@"%@", min];// 小时 house = [NSString stringWithFormat:@"%d", (int)cha/3600];// house = [house substringToIndex:house.length-7]; house=[NSString stringWithFormat:@"%@", house];timeString=[NSString stringWithFormat:@"%@:%@:%@",house,min,sen]; [date release];return timeString;}一个时间距现在的时间- (NSString *)intervalSinceNow: (NSString *) theDate{ NSArray *timeArray=[theDate componentsSeparatedByString:@"."]; theDate=[timeArray objectAtIndex:0]; NSDateFormatter *date=[[NSDateFormatter alloc] init]; [date setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; NSDate *d=[date dateFromString:theDate]; NSTimeInterval late=[d timeIntervalSince1970]*1;NSDate* dat = [NSDate date]; NSTimeInterval now=[dat timeIntervalSince1970]*1; NSString *timeString=@""; NSTimeInterval cha=late-now; if (cha/3600<1) { timeString = [NSString stringWithFormat:@"%f", cha/60]; timeString = [timeString substringToIndex:timeString.length-7]; timeString=[NSString stringWithFormat:@"剩余%@分", timeString]; } if (cha/3600>1&&cha/86400<1) { timeString = [NSString stringWithFormat:@"%f", cha/3600]; timeString = [timeString substringToIndex:timeString.length-7]; timeString=[NSString stringWithFormat:@"剩余%@小时", timeString]; } if (cha/86400>1) { timeString = [NSString stringWithFormat:@"%f", cha/86400]; timeString = [timeString substringToIndex:timeString.length-7]; timeString=[NSString stringWithFormat:@"剩余%@天", timeString]; } [date release]; return timeString;}
2023-07-25 23:10:021

请问各位大神怎么提取以空格分割的NSString中的每串字符

NSString *string = @"1234 634 987"; NSArray *strArr = [string componentsSeparatedByString:@" "];// 以空格分割成数组,依次读取数组中的元素
2023-07-25 23:10:091

如何通过js获取网页中所有图片并加入点击事件,实现

在网页加载完成时,通过js获取图片和添加点击的识别方式- (void)webViewDidFinishLoad:(UIWebView *)webView {[IDProgressHUD IDPlaceViewHideDirect:self.view];//这里是js,主要目的实现对url的获取static NSString * const jsGetImages =@"function getImages(){var objs = document.getElementsByTagName("img");var imgScr = "";for(var i=0;i<objs.length;i++){imgScr = imgScr + objs[i].src + "+";};return imgScr;};";[webView stringByEvaluatingJavaScriptFromString:jsGetImages];//注入js方法NSString *urlResurlt = [webView stringByEvaluatingJavaScriptFromString:@"getImages()"];mUrlArray = [NSMutableArray arrayWithArray:[urlResurlt componentsSeparatedByString:@"+"]];if (mUrlArray.count >= 2) {[mUrlArray removeLastObject];}//urlResurlt 就是获取到得所有图片的url的拼接;mUrlArray就是所有Url的数组//添加图片可点击js[mWebView stringByEvaluatingJavaScriptFromString:@"function registerImageClickAction(){var imgs=document.getElementsByTagName("img");var length=imgs.length;for(var i=0;i<length;i++){img=imgs[i];img.onclick=function(){window.location.href="image-preview:"+this.src}}}"];[mWebView stringByEvaluatingJavaScriptFromString:@"registerImageClickAction();"];}//在这个方法中捕获到图片的点击事件和被点击图片的url- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {//预览图片if ([request.URL.scheme isEqualToString:@"image-preview"]) {NSString* path = [request.URL.absoluteString substringFromIndex:[@"image-preview:" length]];path = [path stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];//path 就是被点击图片的urlreturn NO;}return YES;}
2023-07-25 23:10:251

怎么限制NSTextField只能输入数字其他不能输入

#define NUMBERS @"0123456789 "- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{ NSCharacterSet *cs; if(textField == phoneNumberField) { cs = [[NSCharacterSet characterSetWithCharactersInString:NUMBERS] invertedSet]; NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""]; BOOL basicTest = [string isEqualToString:filtered]; if(!basicTest) { UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"请输入数字" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil]; [alert show]; [alert release]; return NO; } } //其他的类型不需要检测,直接写入 return YES; }如果输入的不是数字,进行提示。
2023-07-25 23:10:431

ios 怎样关闭textfield 的 长按手势

请问你是怎么禁用的
2023-07-25 23:10:512

如何在textfield中固定一些字符

两个代理方法 一个是点击return 缩回键盘还有一个是对textField的输入进行监听前提是需要对textField进行代理监听//UITextFieldDelegate- (BOOL)textFieldShouldReturn:(UITextField *)textField;{//用户结束输入[textField resignFirstResponder];return YES;}- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange NSRange)range replacementString NSString*)string // return NO to not change text{//判断是否超过 ACCOUNT_MAX_CHARS 个字符,注意要判断当string.leng>0//的情况才行,如果是删除的时候,string.length==0int length = textField.text.length;if (length >= ACCOUNT_MAX_CHARS && string.length >0){return NO;}NSCharacterSet *cs;cs = [[NSCharacterSet characterSetWithCharactersInString:kAlphaNum] invertedSet];NSString *filtered =[[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];BOOL basic = [string isEqualToString:filtered];return basic;}
2023-07-25 23:10:581

如何在iOS地图上高效的显示大量数据

使用iPad即可
2023-07-25 23:11:065

iOS 文本框输入数字,每四位自动加空格 怎么做

做个判断就可以了@interface ViewController ()<UITextFieldDelegate>{ UITextField * _numberFielde;}#define NUMBERS @"0123456789"@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad];_numberFielde = [[UITextField alloc] initWithFrame:CGRectMake(0, 100,self.view.frame.size.width, 50)]; _numberFielde.layer.borderColor = [UIColor grayColor].CGColor; _numberFielde.layer.borderWidth = 1.0f; _numberFielde.delegate = self; [_numberFielde becomeFirstResponder]; _numberFielde.placeholder = @"请输入数字"; [self.view addSubview:_numberFielde]; // Do any additional setup after loading the view, typically from a nib.}- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {NSCharacterSet*cs; cs = [[NSCharacterSet characterSetWithCharactersInString:NUMBERS] invertedSet]; NSString*filtered = [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""]; BOOL basicTest = [string isEqualToString:filtered];if(basicTest) { if (textField == _numberFielde) { // 四位加一个空格 if ([string isEqualToString:@""]){ // 删除字符 if ((textField.text.length - 2) % 5 == 0) { textField.text = [textField.text substringToIndex:textField.text.length - 1]; } return YES; } else { if (textField.text.length % 5 == 0) { textField.text = [NSString stringWithFormat:@"%@ ", textField.text]; } } return YES; } } else { return NO; } return YES;}
2023-07-25 23:11:201

(高分求助)怎么用C#语言实现串口通讯,需要程序,急!

☆★○●◎◇◆□℃‰?■△▲※→←↑↓〓☆★○●◎◇◆□℃‰?■△▲※→←↑↓〓☆★○●◎◇◆□℃‰?■△▲※→←↑↓〓☆★○●◎◇◆□℃‰?■△▲※→←↑↓〓通常,在C#中实现串口通信,我们有四种方法: 第一:通过MSCOMM控件这是最简单的,最方便的方法。可功能上很难做到控制自如,同时这个控件并不是系统本身所带,所以还得注册。可以访问http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=320一个外国人写的教程 第二:微软在.NET新推出了一个串口控件,基于.NET的P/Invoke调用方法实现,详细的可以访问微软网站Serial CommUse P/Invoke to Develop a .NET Base Class Library for Serial Device Communicationshttp://msdn.microsoft.com/msdnmag/issues/02/10/netserialcomm/ 第三:就是用第三方控件啦,可一般都要付费的,不太合实际,何况楼主不喜欢,不作考虑 第四:自己用API写串口通信,这样难度高点,但对于我们来说,可以方便实现自己想要的各种功能。 我们采用第四种方法来实现串口通信,用现成的已经封装好的类库,常见两个串口操作类是JustinIO和SerialStreamReader。介绍JustinIO的使用方法: 打开串口: 函数原型:public void Open() 说明:打开事先设置好的端口 示例:using JustinIO;static JustinIO.CommPort ss_port = new JustinIO.CommPort();ss_port.PortNum = COM1; //端口号ss_port.BaudRate = 19200; //串口通信波特率ss_port.ByteSize = 8; //数据位ss_port.Parity = 0; //奇偶校验ss_port.StopBits = 1;//停止位ss_port.ReadTimeout = 1000; //读超时try{ if (ss_port.Opened) { ss_port.Close(); ss_port.Open(); //打开串口 } else { ss_port.Open();//打开串口 } return true;}catch(Exception e) { MessageBox.Show("错误:" + e.Message); return false;} 写串口: 函数原型:public void Write(byte[] WriteBytes) WriteBytes 就是你的写入的字节,注意,字符串要转换成字节数组才能进行通信 示例:ss_port.Write(Encoding.ASCII.GetBytes("AT+CGMI ")); //获取手机品牌 读串口: 函数原型:public byte[] Read(int NumBytes) NumBytes 读入缓存数,注意读取来的是字节数组,要实际应用中要进行字符转换 示例:string response = Encoding.ASCII.GetString(ss_port.Read(128)); //读取128个字节缓存 关闭串口: 函数原型:ss_port.Close() 示例:ss_port.Close();整合代码:using System;using System.Runtime.InteropServices;namespace JustinIO {class CommPort {public int PortNum; public int BaudRate;public byte ByteSize;public byte Parity; // 0-4=no,odd,even,mark,space public byte StopBits; // 0,1,2 = 1, 1.5, 2 public int ReadTimeout;//comm port win32 file handleprivate int hComm = -1;public bool Opened = false; //win32 api constants private const uint GENERIC_READ = 0x80000000; private const uint GENERIC_WRITE = 0x40000000; private const int OPEN_EXISTING = 3; private const int INVALID_HANDLE_VALUE = -1;[StructLayout(LayoutKind.Sequential)]public struct DCB {//taken from c struct in platform sdk public int DCBlength; // sizeof(DCB) public int BaudRate; // current baud rate/* these are the c struct bit fields, bit twiddle flag to setpublic int fBinary; // binary mode, no EOF check public int fParity; // enable parity checking public int fOutxCtsFlow; // CTS output flow control public int fOutxDsrFlow; // DSR output flow control public int fDtrControl; // DTR flow control type public int fDsrSensitivity; // DSR sensitivity public int fTXContinueOnXoff; // XOFF continues Tx public int fOutX; // XON/XOFF out flow control public int fInX; // XON/XOFF in flow control public int fErrorChar; // enable error replacement public int fNull; // enable null stripping public int fRtsControl; // RTS flow control public int fAbortOnError; // abort on error public int fDummy2; // reserved */public uint flags;public ushort wReserved; // not currently used public ushort XonLim; // transmit XON threshold public ushort XoffLim; // transmit XOFF threshold public byte ByteSize; // number of bits/byte, 4-8 public byte Parity; // 0-4=no,odd,even,mark,space public byte StopBits; // 0,1,2 = 1, 1.5, 2 public char XonChar; // Tx and Rx XON character public char XoffChar; // Tx and Rx XOFF character public char ErrorChar; // error replacement character public char EofChar; // end of input character public char EvtChar; // received event character public ushort wReserved1; // reserved; do not use }[StructLayout(LayoutKind.Sequential)]private struct COMMTIMEOUTS { public int ReadIntervalTimeout; public int ReadTotalTimeoutMultiplier; public int ReadTotalTimeoutConstant; public int WriteTotalTimeoutMultiplier; public int WriteTotalTimeoutConstant; } [StructLayout(LayoutKind.Sequential)]private struct OVERLAPPED { public int Internal; public int InternalHigh; public int Offset; public int OffsetHigh; public int hEvent; } [DllImport("kernel32.dll")]private static extern int CreateFile( string lpFileName, // file name uint dwDesiredAccess, // access mode int dwShareMode, // share mode int lpSecurityAttributes, // SD int dwCreationDisposition, // how to create int dwFlagsAndAttributes, // file attributes int hTemplateFile // handle to template file);[DllImport("kernel32.dll")]private static extern bool GetCommState( int hFile, // handle to communications device ref DCB lpDCB // device-control block);[DllImport("kernel32.dll")]private static extern bool BuildCommDCB( string lpDef, // device-control string ref DCB lpDCB // device-control block);[DllImport("kernel32.dll")]private static extern bool SetCommState( int hFile, // handle to communications device ref DCB lpDCB // device-control block);[DllImport("kernel32.dll")]private static extern bool GetCommTimeouts( int hFile, // handle to comm device ref COMMTIMEOUTS lpCommTimeouts // time-out values);[DllImport("kernel32.dll")]private static extern bool SetCommTimeouts( int hFile, // handle to comm device ref COMMTIMEOUTS lpCommTimeouts // time-out values);[DllImport("kernel32.dll")]private static extern bool ReadFile( int hFile, // handle to file byte[] lpBuffer, // data buffer int nNumberOfBytesToRead, // number of bytes to read ref int lpNumberOfBytesRead, // number of bytes read ref OVERLAPPED lpOverlapped // overlapped buffer);[DllImport("kernel32.dll")]private static extern bool WriteFile( int hFile, // handle to file byte[] lpBuffer, // data buffer int nNumberOfBytesToWrite, // number of bytes to write ref int lpNumberOfBytesWritten, // number of bytes written ref OVERLAPPED lpOverlapped // overlapped buffer);[DllImport("kernel32.dll")]private static extern bool CloseHandle( int hObject // handle to object);[DllImport("kernel32.dll")]private static extern uint GetLastError();public void Open() { DCB dcbCommPort = new DCB(); COMMTIMEOUTS ctoCommPort = new COMMTIMEOUTS();// OPEN THE COMM PORT.hComm = CreateFile("COM" + PortNum ,GENERIC_READ | GENERIC_WRITE,0, 0,OPEN_EXISTING,0,0); // IF THE PORT CANNOT BE OPENED, BAIL OUT. if(hComm == INVALID_HANDLE_VALUE) { throw(new ApplicationException("Comm Port Can Not Be Opened")); } // SET THE COMM TIMEOUTS. GetCommTimeouts(hComm,ref ctoCommPort); ctoCommPort.ReadTotalTimeoutConstant = ReadTimeout; ctoCommPort.ReadTotalTimeoutMultiplier = 0; ctoCommPort.WriteTotalTimeoutMultiplier = 0; ctoCommPort.WriteTotalTimeoutConstant = 0; SetCommTimeouts(hComm,ref ctoCommPort); // SET BAUD RATE, PARITY, WORD SIZE, AND STOP BITS. GetCommState(hComm, ref dcbCommPort); dcbCommPort.BaudRate=BaudRate; dcbCommPort.flags=0; //dcb.fBinary=1; dcbCommPort.flags|=1; if (Parity>0) { //dcb.fParity=1 dcbCommPort.flags|=2; } dcbCommPort.Parity=Parity; dcbCommPort.ByteSize=ByteSize; dcbCommPort.StopBits=StopBits; if (!SetCommState(hComm, ref dcbCommPort)) { //uint ErrorNum=GetLastError(); throw(new ApplicationException("Comm Port Can Not Be Opened")); } //unremark to see if setting took correctly //DCB dcbCommPort2 = new DCB(); //GetCommState(hComm, ref dcbCommPort2); Opened = true; }public void Close() {if (hComm!=INVALID_HANDLE_VALUE) {CloseHandle(hComm);}}public byte[] Read(int NumBytes) {byte[] BufBytes;byte[] OutBytes;BufBytes = new byte[NumBytes];if (hComm!=INVALID_HANDLE_VALUE) {OVERLAPPED ovlCommPort = new OVERLAPPED();int BytesRead=0;ReadFile(hComm,BufBytes,NumBytes,ref BytesRead,ref ovlCommPort);OutBytes = new byte[BytesRead];Array.Copy(BufBytes,OutBytes,BytesRead);} else {throw(new ApplicationException("Comm Port Not Open"));}return OutBytes;}public void Write(byte[] WriteBytes) {if (hComm!=INVALID_HANDLE_VALUE) {OVERLAPPED ovlCommPort = new OVERLAPPED();int BytesWritten = 0;WriteFile(hComm,WriteBytes,WriteBytes.Length,ref BytesWritten,ref ovlCommPort);}else {throw(new ApplicationException("Comm Port Not Open"));}}}}} 由于篇幅,以及串口通信涉及内容广泛,我在这里只讲这些。
2023-07-25 23:11:291

this program cannot be run in dos made 什么意思

这个 程序不能在DOS上运行
2023-07-25 23:11:433

canot locate microsoft excel components,我想安装QCMS

装了excel了吗装了的话 到注册表HKEY_CURRENT_USERSoftwareMicrosoftOffice版本CommonGeneral 添加string STARTUP
2023-07-25 23:11:531

求助如何更新TextField里的内容

你用的什么IDE啊。。。。或者什么语言,一般都会有接口函数进行操作 ,定义变量,然后用点号,系统可能一般都会给与提示,类似于 settext 字样的东西,或者查询相应的手册。。
2023-07-25 23:12:122

IOS textField怎样设置只能输入英文字母或者数字,不能输入汉字

//判断是否是数字,不是的话就输入失败- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{NSCharacterSet *cs;cs = [[NSCharacterSet characterSetWithCharactersInString:kAlphaNum] invertedSet];NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""]; //按cs分离出数组,数组按@""分离出字符串BOOL canChange = [string isEqualToString:filtered];return self.textField.text.length>=5?NO: canChange;
2023-07-25 23:12:211

SQlite数据库怎么在安卓平台上导出成cvs或者excel

1、命令导出 实现方式: 将输出重定向至文件. 命令: .output sqlite> .output a.txt 然后输入sql语句, 查询出要导的数据. 查询后,数据不会显示在屏幕上,而直接写入文件.2、或者你下载一些第三方的工具,直接浏览保存为 xls 文件。 SQLiteMan SQLite Manager SQLite Database Browser SqlPro SQL ClientCSV全称 Comma Separated values,是一种用来存储数据的纯文本文件格式,通常用于电子表格或数据库软件。用Excel或者Numbers都可以导出CSV格式的数据。
2023-07-25 23:12:302

InputThe input will consist of a series of pairs of integers a and b, separated by a space, one pair

输入“input”后,会组成一对整数数列a和b,中间以一个空格分隔
2023-07-25 23:13:002

jdk6和jdk8的编码区别

更简单的异常处理语句2. 字符串支持switch3. 二进制值定义
2023-07-25 23:13:154

Java:为什么override了JPanel的paintComponents却没画出来呢?

因为你override了
2023-07-25 23:13:234

opc core components redistributable可以卸载吗

@Order(2)public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected String[] getServletMappings() { return new String[]{"/"}; }
2023-07-25 23:13:381

怎样把这一段字符串转换成123456

- (NSString *)TextFromAsciiCodesString:(NSString *)string { NSArray *components = [string componentsSeparatedByString:@" "]; NSUInteger len = [components count]; char new_str[len+1]; int i; for (i = 0; i < len; ++i) new_str[i] = [[components objectAtIndex:i] intValue]; new_str[i] = ""; return [NSString stringWithCString:new_str encoding:NSASCIIStringEncoding]; } 转换后输出就是123456
2023-07-25 23:13:581

ios里面怎样监听js的事件

在iOS开发之Objective-C与JavaScript交互操作 中我们可以通过stringByEvaluatingJavaScriptFromString 去实现在obj-C中获取到相关节点属性,添加javascript代码等功能。但是我们如何监听到javascript的响应事件呢。在MAC OS中有效的API去实现,但iPhone没有,但我们有一个技巧途径:大概思路是:在JavaScript事件响应时,通过设置document.location,这会引发webview的一个delegate方法,从而实现发送通知的效果,即达到监听的目的。1、在javascript与webView之间定一个协议约定: myapp:myfunction:myparam1:myparam22、在javascript中添加代码:document.location = "myapp:" + "myfunction:" + param1 + ":" + param2;3、在webView的delegate方法webView:shouldStartLoadWithRequest:navigationType: 添加- (BOOL)webView:(UIWebView *)webView2 shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { NSString *requestString = [[request URL] absoluteString]; NSArray *components = [requestString componentsSeparatedByString:@":"]; if ([components count] > 1 && [(NSString *)[components objectAtIndex:0] isEqualToString:@"myapp"]) { if([(NSString *)[components objectAtIndex:1] isEqualToString:@"myfunction"]) { NSLog([components objectAtIndex:2]); // param1 NSLog([components objectAtIndex:3]); // param2 // Call your method in Objective-C method using the above... } return NO; } return YES; // Return YES to make sure regular navigation works as expected.}
2023-07-25 23:14:051

ios里面怎样监听js的事件

在iOS开发之Objective-C与JavaScript交互操作 中可以通过stringByEvaluatingJavaScriptFromString 去实现在obj-C中获取到相关节点属性,添加javascript代码等功能。但是如何监听到javascript的响应事件呢。在MAC OS中有效的API去实现,但iPhone没有,但有一个技巧途径:大概思路是:在JavaScript事件响应时,通过设置document.location,这会引发webview的一个delegate方法,从而实现发送通知的效果,即达到监听的目的。1、在javascript与webView之间定一个协议约定: myapp:myfunction:myparam1:myparam22、在javascript中添加代码:document.location = "myapp:" + "myfunction:" + param1 + ":" + param2;3、在webView的delegate方法webView:shouldStartLoadWithRequest:navigationType: 添加- (BOOL)webView:(UIWebView *)webView2 shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { NSString *requestString = [[request URL] absoluteString]; NSArray *components = [requestString componentsSeparatedByString:@":"]; if ([components count] > 1 && [(NSString *)[components objectAtIndex:0] isEqualToString:@"myapp"]) { if([(NSString *)[components objectAtIndex:1] isEqualToString:@"myfunction"]) { NSLog([components objectAtIndex:2]); // param1 NSLog([components objectAtIndex:3]); // param2 // Call your method in Objective-C method using the above... } return NO; } return YES; // Return YES to make sure regular navigation works as expected.
2023-07-25 23:14:231

ios里面怎样监听js的事件

IOS可以监听url的变化。所以,js事件发生的时候,改变url的变化,从而IOS监听到了URL的变化,从而知道发生了什么js事件(预先定义好一套规则)可能还有其他方式,我只是给个思路。
2023-07-25 23:14:302

ios textview 怎么监听事件

在iOS开发之Objective-C与JavaScript交互操作 中我们可以通过stringByEvaluatingJavaScriptFromString 去实现在obj-C中获取到相关节点属性,添加javascript代码等功能。但是我们如何监听到javascript的响应事件呢。在MAC OS中有效的API去实现,但iPhone没有,但我们有一个技巧途径:大概思路是:在JavaScript事件响应时,通过设置document.location,这会引发webview的一个delegate方法,从而实现发送通知的效果,即达到监听的目的。1、在javascript与webView之间定一个协议约定:myapp:myfunction:myparam1:myparam22、在javascript中添加代码:document.location = "myapp:" + "myfunction:" + param1 + ":" + param2;3、在webView的delegate方法webView:shouldStartLoadWithRequest:navigationType: 添加- (BOOL)webView:(UIWebView *)webView2 shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {NSString *requestString = [[request URL] absoluteString];NSArray *components = [requestString componentsSeparatedByString:@":"];if ([components count] > 1 && [(NSString *)[components objectAtIndex:0] isEqualToString:@"myapp"]) {if([(NSString *)[components objectAtIndex:1] isEqualToString:@"myfunction"]) {NSLog([components objectAtIndex:2]); // param1NSLog([components objectAtIndex:3]); // param2// Call your method in Objective-C method using the above...}return NO;}return YES; // Return YES to make sure regular navigation works as expected.}
2023-07-25 23:14:381

标签怎么用?求详解

两个代理方法 一个是点击return 缩回键盘  还有一个是对textField的输入进行监听  前提是需要对textField进行代理监听  //UITextFieldDelegate  - (BOOL)textFieldShouldReturn:(UITextField *)textField;  {  //用户结束输入  [textField resignFirstResponder];  return YES;  }  - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange NSRange)range replacementString NSString*)string // return NO to not change text  {  //判断是否超过 ACCOUNT_MAX_CHARS 个字符,注意要判断当string.leng>0  //的情况才行,如果是删除的时候,string.length==0  int length = textField.text.length;  if (length >= ACCOUNT_MAX_CHARS && string.length >0)  {  return NO;  }  NSCharacterSet *cs;  cs = [[NSCharacterSet characterSetWithCharactersInString:kAlphaNum] invertedSet];  NSString *filtered =  [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];  BOOL basic = [string isEqualToString:filtered];  return basic;  }
2023-07-25 23:14:461

求助如何自动让Textfield获取焦点

两个代理方法 一个是点击return 缩回键盘  还有一个是对textField的输入进行监听  前提是需要对textField进行代理监听  //UITextFieldDelegate  - (BOOL)textFieldShouldReturn:(UITextField *)textField;  {  //用户结束输入  [textField resignFirstResponder];  return YES;  }  - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange NSRange)range replacementString NSString*)string // return NO to not change text  {  //判断是否超过 ACCOUNT_MAX_CHARS 个字符,注意要判断当string.leng>0  //的情况才行,如果是删除的时候,string.length==0  int length = textField.text.length;  if (length >= ACCOUNT_MAX_CHARS && string.length >0)  {  return NO;  }  NSCharacterSet *cs;  cs = [[NSCharacterSet characterSetWithCharactersInString:kAlphaNum] invertedSet];  NSString *filtered =  [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];  BOOL basic = [string isEqualToString:filtered];  return basic;  }
2023-07-25 23:14:531

如何让textfield一出现就获取焦点

  在于tableview关联的NSarray中设置一个控制字段,例如bool值flag,button点击,则flag=!flag,然后【table reloadData】,在-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath中根据flag值判断该cell中的textfield是否显示以及是否设置[textfield becomeFirstResponder]
2023-07-25 23:15:002

如何限制在UITextField中只能输入数字

使用正则表达式规定输入的是[0-9]就可以了
2023-07-25 23:15:072

如何限制在UITextField中只能输入数字

#define NUMBERS @"0123456789 "- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{NSCharacterSet *cs; if(textField == phoneNumberField){cs = [[NSCharacterSet characterSetWithCharactersInString:NUMBERS] invertedSet]; NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""]; BOOL basicTest = [string isEqualToString:filtered];if(!basicTest){UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"提示"message:@"请输入数字" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];[alert show];[alert release];return NO;} }//其他的类型不需要检测,直接写入return YES; }如果输入的不是数字,进行提示。
2023-07-25 23:15:141

如何限制在UITextField中只能输入数字

#define NUMBERS @"0123456789 "- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{ NSCharacterSet *cs; if(textField == phoneNumberField) { cs = [[NSCharacterSet characterSetWithCharactersInString:NUMBERS] invertedSet]; NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""]; BOOL basicTest = [string isEqualToString:filtered]; if(!basicTest) { UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"请输入数字" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil]; [alert show]; [alert release]; return NO; } } //其他的类型不需要检测,直接写入 return YES; }如果输入的不是数字,进行提示。
2023-07-25 23:15:211

如何限制在UITextField中只能输入数字

#define NUMBERS @"0123456789 "- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{ NSCharacterSet *cs; if(textField == phoneNumberField) { cs = [[NSCharacterSet characterSetWithCharactersInString:NUMBERS] invertedSet]; NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""]; BOOL basicTest = [string isEqualToString:filtered]; if(!basicTest) { UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"请输入数字" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil]; [alert show]; [alert release]; return NO; } } //其他的类型不需要检测,直接写入 return YES; }如果输入的不是数字,进行提示。
2023-07-25 23:15:391

怎样获得TableView中TextField.text

UITextField *textField=[[UITextField alloc] initWithFrame:CGRectMake(250, 50, 150, 22)]; textField.tag=[indexPath row]; textField.delegate=self; textField.placeholder = @"请输入"; textField.font = [UIFont fontWithName:@"Times New Roman" size:25]; [textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged]; [cell addSubview:textField];//第二步,实现回调函数- (void) textFieldDidChange:(id) sender { NSNumber *tag=[NSNumber numberWithInt:[sender tag]]; UITextField *_field = (UITextField *)sender; NSLog(@"tag%@",tag); NSLog(@"_field%@",[_field text]);}
2023-07-25 23:15:472

怎么判断textfield里的字符串是否改变

两个代理方法 一个是点击return 缩回键盘  还有一个是对textField的输入进行监听  前提是需要对textField进行代理监听  //UITextFieldDelegate  - (BOOL)textFieldShouldReturn:(UITextField *)textField;  {  //用户结束输入  [textField resignFirstResponder];  return YES;  }  - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange NSRange)range replacementString NSString*)string // return NO to not change text  {  //判断是否超过 ACCOUNT_MAX_CHARS 个字符,注意要判断当string.leng>0  //的情况才行,如果是删除的时候,string.length==0  int length = textField.text.length;  if (length >= ACCOUNT_MAX_CHARS && string.length >0)  {  return NO;  }  NSCharacterSet *cs;  cs = [[NSCharacterSet characterSetWithCharactersInString:kAlphaNum] invertedSet];  NSString *filtered =  [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];  BOOL basic = [string isEqualToString:filtered];  return basic;  }
2023-07-25 23:15:541

如何限制在UITextField中只能输入数字

#define NUMBERS @"0123456789 "- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{ NSCharacterSet *cs; if(textField == phoneNumberField) { cs = [[NSCharacterSet characterSetWithCharactersInString:NUMBERS] invertedSet]; NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""]; BOOL basicTest = [string isEqualToString:filtered]; if(!basicTest) { UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"请输入数字" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil]; [alert show]; [alert release]; return NO; } } //其他的类型不需要检测,直接写入 return YES; }如果输入的不是数字,进行提示。
2023-07-25 23:16:011

怎么限制NSTextField只能输入数字其他不能输入

#define NUMBERS @"0123456789 "- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{NSCharacterSet *cs;if(textField == phoneNumberField){cs = [[NSCharacterSet characterSetWithCharactersInString:NUMBERS] invertedSet];NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];BOOL basicTest = [string isEqualToString:filtered];if(!basicTest){UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"提示"message:@"请输入数字"delegate:nilcancelButtonTitle:@"确定"otherButtonTitles:nil];[alert show];[alert release];return NO;}}//其他的类型不需要检测,直接写入return YES; }如果输入的不是数字,进行提示。
2023-07-25 23:16:081

xib可以设置textfield的leftview吗

两个代理方法 一个是点击return 缩回键盘  还有一个是对textField的输入进行监听  前提是需要对textField进行代理监听  //UITextFieldDelegate  - (BOOL)textFieldShouldReturn:(UITextField *)textField;  {  //用户结束输入  [textField resignFirstResponder];  return YES;  }  - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange NSRange)range replacementString NSString*)string // return NO to not change text  {  //判断是否超过 ACCOUNT_MAX_CHARS 个字符,注意要判断当string.leng>0  //的情况才行,如果是删除的时候,string.length==0  int length = textField.text.length;  if (length >= ACCOUNT_MAX_CHARS && string.length >0)  {  return NO;  }  NSCharacterSet *cs;  cs = [[NSCharacterSet characterSetWithCharactersInString:kAlphaNum] invertedSet];  NSString *filtered =  [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];  BOOL basic = [string isEqualToString:filtered];  return basic;  }
2023-07-25 23:16:161

mac os 开发 nstextfield 点击输入的时候 textfield会显示一个边框,怎么设置 能使nstextfield不显示边框

答非所问,继承至NSVIEW 的类 都有一个focusRingType, 设置 .focusRingType = NSFocusRingTypeNone 即可
2023-07-25 23:16:233

ios 怎么追踪代码执行的路径

-(void) loadRoute{NSString* filePath = [[NSBundle mainBundle] pathForResource:@”route” ofType:@”csv”];NSString* fileContents = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];NSArray* pointStrings = [fileContents componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];// while we create the route points, we will also be calculating the bounding box of our route// so we can easily zoom in on it.MKMapPoint northEastPoint;MKMapPoint southWestPoint; // create a c array of points.MKMapPoint* pointArr = malloc(sizeof(CLLocationCoordinate2D) * pointStrings.count);for(int idx = 0; idx < pointStrings.count; idx++){// break the string down even further to latitude and longitude fields.NSString* currentPointString = [pointStrings objectAtIndex:idx];NSArray* latLonArr = [currentPointString componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@","]];CLLocationDegrees latitude = [[latLonArr objectAtIndex:0] doubleValue];CLLocationDegrees longitude = [[latLonArr objectAtIndex:1] doubleValue];// create our coordinate and add it to the correct spot in the arrayCLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(latitude, longitude);MKMapPoint point = MKMapPointForCoordinate(coordinate);//// adjust the bounding box//// if it is the first point, just use them, since we have nothing to compare to yet.if (idx == 0) {northEastPoint = point;southWestPoint = point;}else{if (point.x > northEastPoint.x)northEastPoint.x = point.x;if(point.y > northEastPoint.y)northEastPoint.y = point.y;if (point.x < southWestPoint.x)southWestPoint.x = point.x;if (point.y < southWestPoint.y)southWestPoint.y = point.y;}pointArr[idx] = point;}// create the polyline based on the array of points.self.routeLine = [MKPolyline polylineWithPoints:pointArr count:pointStrings.count];_routeRect = MKMapRectMake(southWestPoint.x, southWestPoint.y, northEastPoint.x - southWestPoint.x, northEastPoint.y - southWestPoint.y);// clear the memory allocated earlier for the pointsfree(pointArr);}
2023-07-25 23:16:311

解析Json数据,用什么第三方库,方便一点的,最好有demo

  JSONKitNSString * URL = [NSString stringWithFormat:@"%@/QR.jsp?ID=%@&QR=%@",[[SharedDataBaseManager sharedManager]getServerUrl],[[SharedDataBaseManager sharedManager]getLoginUserName],self.resultLabel.text];AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; // 设置请求格式 manager.requestSerializer = [AFJSONRequestSerializer serializer]; // 设置返回格式 manager.responseSerializer = [AFHTTPResponseSerializer serializer]; [manager POST:URL parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { NSString *result = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"[]{}(#%-*+=_)\|~(<>$%^&*)_+ "]; result = [[result componentsSeparatedByCharactersInSet: doNotWant]componentsJoinedByString: @""]; result = [result stringByReplacingOccurrencesOfString:@" " withString:@""]; result = [result stringByReplacingOccurrencesOfString:@" " withString:@""]; NSLog(@"%@",result); if ([result isEqualToString:@"YES"]) { UIAlertView *alertA= [[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:@"成功"] delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alertA show]; } else { UIAlertView *alertA= [[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:@"失败"] delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alertA show]; }} failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"ERROR %@", error); }];
2023-07-25 23:16:381

解析Json数据,用什么第三方库,方便一点的,最好有demo

JSONKit代码NSString * URL = [NSString stringWithFormat:@"%@/QR.jsp?ID=%@&QR=%@",[[SharedDataBaseManager sharedManager]getServerUrl],[[SharedDataBaseManager sharedManager]getLoginUserName],self.resultLabel.text];AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; // 设置请求格式 manager.requestSerializer = [AFJSONRequestSerializer serializer]; // 设置返回格式 manager.responseSerializer = [AFHTTPResponseSerializer serializer]; [manager POST:URL parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { NSString *result = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"[]{}(#%-*+=_)\|~(<>$%^&*)_+ "]; result = [[result componentsSeparatedByCharactersInSet: doNotWant]componentsJoinedByString: @""]; result = [result stringByReplacingOccurrencesOfString:@" " withString:@""]; result = [result stringByReplacingOccurrencesOfString:@" " withString:@""]; NSLog(@"%@",result); if ([result isEqualToString:@"YES"]) { UIAlertView *alertA= [[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:@"成功"] delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alertA show]; } else { UIAlertView *alertA= [[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:@"失败"] delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alertA show]; }} failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@"ERROR %@", error); }];
2023-07-25 23:16:561

读取一个文本文件中逐行 Swift 吗

你可以尝试:if let path = NSBundle.mainBundle().pathForResource("TextFile", ofType: "txt"){ var data = String(contentsOfFile:path, encoding: NSUTF8StringEncoding, error: nil) if let content = (data){ let myStrings = content.componentsSeparatedByCharactersInSet(NSCharacterSet.newlineCharacterSet()) TextView.text = myStrings[0] }}该变量 myStrings 应该是每行的数据。使用的代码是从: iOS SDK 中逐行读取文件写在 Obj C 和使用 NSString
2023-07-25 23:17:031

ultimus bpm studio 怎么新建流程

NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"[]{}(#%-*+=_)\|~(<>$%^&*)_+ "]; result = [[result componentsSeparatedByCharactersInSet: doNotWant]componentsJoinedByString: @""]; result = [result stringByReplacingOccurrencesOfString:@" " withString:@""]; result = [result stringByReplacingOccurrencesOfString:@" " withString:@""]; NSLog(@"%@",result); if ([result isEqualToString:@"YES"]) { UIAlertView *alertA= [[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:@"成功"] delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alertA show]; } else {
2023-07-25 23:17:101

swift如何解析字符串

Swift_字符串详解(String)类型别名//类型别名fileprivate func testTypeAliases() {let index = String.Index.selfprint("(index)")let utf8index = String.UTF8Index.selfprint("(utf8index)")let utf16index = String.UTF16Index.selfprint("(utf16index)")let unicodeScalarIndex = String.UnicodeScalarIndex.selfprint("(unicodeScalarIndex)")let greeting = "XuBaoAiChiYu"print(greeting[greeting.startIndex])//输出字符串的第一个字符print(greeting[greeting.characters.index(before: greeting.endIndex)])//输出字符串的最后一个字符print(greeting[greeting.characters.index(after: greeting.startIndex)])//输出字符串的第二个字符print(greeting[greeting.characters.index(greeting.startIndex, offsetBy: 7)])//输出字符串的第八个字符/* printIndexIndexIndexIndexXuuC*/}初始化//初始化fileprivate func testInitializers() {//初始化var string: String = String()string = "XuBaoAiChiYu"print(string)//char 初始化let char: Character = "X"string = String(char)print(string)string = String.init(char)print(string)string = "(char)"print(string)// 通过CharacterViewlet charView: String.CharacterView = String.CharacterView("XuBaoAiChiYu")string = String(charView)print(string)//通过 utf-16 编码let utf16: String.UTF16View = string.utf16string = String(describing: utf16)print(utf16)//通过 utf-8 编码let utf8: String.UTF8View = string.utf8string = String(describing: utf8)print(utf8)//通过多个字符串组合生成string = String(stringInterpolation: "xu", "bao")print(string)//char初始化 连续count次string = String(repeating: String(char), count: 6)print(string)//通过其他常用数据初始化string = String(stringInterpolationSegment: true)print(string)string = String(stringInterpolationSegment: 24)print(string)// 通过NSString初始化,不推荐string = NSString(string: "XuBaoAiChiYu") as Stringprint(string)string = NSString.init(string: "XuBaoAiChiYu") as Stringprint(string)// 组合生成string = NSString(format: "%@", "XuBaoAiChiYu") as Stringprint(string)/* printXuBaoAiChiYuXXXXuBaoAiChiYuXuBaoAiChiYuXuBaoAiChiYuxubaoXXXXXXtrue24XuBaoAiChiYuXuBaoAiChiYuXuBaoAiChiYu*/}文件路径操作//文件路径操作fileprivate func testWorkingWithPaths() {var path = "xubaoaichiyu/ios/swift"print(path)//路径分割成熟数组var pathComponents = (path as NSString).pathComponentsprint(pathComponents)//数组组合成路径path = NSString.path(withComponents: pathComponents)print(path)//Document目录let documents: [String] = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, .userDomainMask, true)print(documents)let documentPath: String = documents.first!print(documentPath)//寻找文件夹下包含多少个路径var complete = documentPath.completePath(caseSensitive: true)print(complete)//寻找文件夹下包含指定扩展名的文件路径个数var outName = ""let filterTypes = ["txt", "plist"]complete = documentPath.completePath(into: &outName, caseSensitive: true, matchesInto: &pathComponents, filterTypes: filterTypes)print("completePathIntoString:(complete)")//添加路径path = (documentPath as NSString).appendingPathComponent("test")print(path)//添加扩展path = (path as NSString).appendingPathExtension("plist")!print(path)print("是否绝对路径:((path as NSString).isAbsolutePath)")print("最后一个路径名:((path as NSString).lastPathComponent)")print("扩展名:((path as NSString).pathExtension)")//去掉扩展名var tempPath = (path as NSString).deletingPathExtensionprint(tempPath)//去掉最后一个路径tempPath = (path as NSString).deletingLastPathComponentprint(tempPath)//转%格式码let allowedCharacters:CharacterSet = CharacterSet.controlCharacterstempPath = path.addingPercentEncoding(withAllowedCharacters: allowedCharacters)!print(tempPath)//转可见tempPath = (tempPath as NSString).removingPercentEncoding!print(tempPath)/* printxubaoaichiyu/ios/swift["xubaoaichiyu", "ios", "swift"]xubaoaichiyu/ios/swift["/Users/caoxu/Documents"]/Users/caoxu/Documents4completePathIntoString:1/Users/caoxu/Documents/test/Users/caoxu/Documents/test.plist是否绝对路径:true最后一个路径名:test.plist扩展名:plist/Users/caoxu/Documents/test/Users/caoxu/Documents%2F%55%73%65%72%73%2F%63%61%6F%78%75%2F%44%6F%63%75%6D%65%6E%74%73%2F%74%65%73%74%2E%70%6C%69%73%74/Users/caoxu/Documents/test.plist*/}
2023-07-25 23:17:171

warning: backslash and newline separated by space [enabled by default]

删除换行符“”后边的空格
2023-07-25 23:17:243

怎样过滤NSString中的特殊字符

字符串过滤一下 1 NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"[]{}(#%-*+=_)\|~(<>$%^&*)_+ "];2 tempString = [[tempString componentsSeparatedByCharactersInSet: doNotWant]componentsJoinedByString: @""];1 里面“”里面放要过滤的字符
2023-07-25 23:17:371

湖南理工学院属于几本

湖南理工学院在省内是一本学校,在省外是二本学校。湖南理工学院,是湖南省人民政府举办,湖南省教育厅主管的以理工科为主的多学科协调发展的省属高校,是湖南省博士学位授予立项建设单位、首批国家产教融合发展工程应用型本科规划高校、湖南省改办大学规划高校、湖南省国内一流学科建设高校。学校校园面积2100余亩,设有20个教学院及1个独立学院(南湖学院),拥有本科专业51个,一级学科硕士学位授权点10个,硕士专业学位授权点12个,国内一流建设学科和国内一流培育学科各1个,省级重点建设学科5个,国家一流本科专业建设点12个。湖南理工学院的前身是1910年创办的湖滨大学。1999年3月经教育部批准,岳阳师范高等专科学校、岳阳大学及岳阳教育学院合并为岳阳师范学院。2003年2月更名为湖南理工学院。2013年7月学校被国务院学位委员会确定为硕士学位授予单位。湖南理工学院科研成果:学校共主持获得国家自科基金项目42项,国家社科基金项目25项;获省级以上科技奖励38项,其中国家科技进步奖二等奖1项,教育部人文社科成果奖二等奖1项,湖南省科学技术奖一等奖1项,湖南省社科成果奖1项。《云梦学刊》“当代学术史研究”栏目入选教育部第三批“名栏建设”工程。该校科技产业产值效益连续10年排名全国高校百强,其中2003年、2004年、2005年在全国高校科技企业收入总额过亿元学校中分别排名第21位、第53位、第16位。由该校发起创办参股的岳泰集团股份有限公司,现已发展为产学研结合、科工贸并举,在全国拥有11家子公司的大型股份制企业集团,年产值达20亿元,直接经济效益过亿元,被湖南省原省委书记杨正午同志称赞为“股份制企业的楷模”。以上数据出自大学生必备网。
2023-07-25 23:13:321