草庐IT

output-formatting

全部标签

ios - swift/正则表达式 : How can I format a string using stringByReplacingMatches(withTemplate)?

我想格式化一个数字字符串,例如123456789,所以第一个数字会被分开,然后每两个数字被分组,得到这个结果:123456789我试过这个:letgivenText="123456789"lettext=(try?NSRegularExpression(pattern:"([0-9])([0-9])(?!$)",options:.caseInsensitive))?.stringByReplacingMatches(in:givenText,options:.reportProgress,range:NSMakeRange(0,givenText.count),withTemplate

iOS Swift 4 : Get Image Format (JPG, PNG,GIF) 来自 didFinishPickingMediaWithInfo

我正在构建一个应用程序,允许您将图像从您的图书馆上传到服务器。该服务器本质上用作图像存储库。因此,绝对有必要将其存储为原始图像格式:JPG、PNG或GIF。IE。如果PNG图像具有透明度,则必须保留它,不能简单地将其转换为JPG。我曾经使用UIImagePickerControllerReferenceURL获取图像格式:funcimagePickerController(_picker:UIImagePickerController,didFinishPickingMediaWithInfoinfo:[String:Any]){letselectedImage=info[UIImag

快速构建 error_if_any_output_files_are_specified_they_all_must_be

当转换为在Xcode10上使用新的构建系统时,我在我的几个扩展目标的输出中收到以下错误。:0:error:ifanyoutputfilesarespecified,theyallmustbeCommandCompileSwiftfailedwithanonzeroexitcode我已经在网上寻找解决方案,但我能找到的关于此错误的唯一引用是Swift编译器源代码本身。https://www.google.com/search?q=error_if_any_output_files_are_specified_they_all_must_be有谁知道这个错误实际上是如何触发的,或者我可以做

swift - 我正在使用 firebase 在 swift 中测试登录身份验证并收到错误 get output frames failed, state 8196

我正在使用firebase在swift中测试登录身份验证并收到错误,输出帧失败,状态8196。这是日志我明白了2018-11-1911:14:42.259565+0530Loginpage[9509:563668]-[I-ACS036002]Analyticsscreenreportingisenabled.Call+[FIRAnalyticssetScreenName:setScreenClass:]tosetthescreennameoroverridethedefaultscreenclassname.Todisablescreenreporting,settheflagFire

json - 处理 json 数据时出错 : The data couldn’t be read because it isn’t in the correct format

这个错误困扰了我一上午,我正在尝试以以下格式检索JSON:song={'artist':'TomWaits','song':'NewCoatOfPaint','lyrics':'Let\'sputanewcoatofpaintonthislonesomeoldtown\nSet\'emup,we\'llbeknockin\'em[...]','url':'http://lyrics.wikia.com/Tom_Waits:New_Coat_Of_Paint'}来自此网址:JSONURL这是我用来解析数据的函数:funcparseJSONFromData(_jsonData:Data?)

iOS : push notification badge count not increase in this payload formate

当应用程序在后台正常运行时,时间角标(Badge)计数未在最后5天前设置。角标(Badge)计数每次由php后端ex增加。当前角标(Badge)=10然后在第二次推送后得到然后角标(Badge)=11我正在使用波纹管有效载荷甲酸盐。如果波纹管甲酸盐有任何变化,请帮助我,我也阅读了ApplePushNotificationService.推送通知负载是一个JSON负载:{"aps":{"badge":10,"alert":"Helloworld!","sound":"cat.caf"}}registerUserNotificationSettingsif(ios8){if([applic

java - Swift 相当于 String.format 和 .Replace?

我有一段java代码。functionReturnValue=String.format("%1$2s",jDay).replace('','0')+"/"+String.format("%1$2s",i).replace('','0')+"/"+dateIn.substring(0,4);swift对应的是什么?这是我目前所拥有的letstring1=String(format:"%1$2s",jDay);letreplacedString=String(string1.characters.map{$0==""?"0":$0})letstring2=String(format:"%

iOS swift : Formatting a custom Currency Number

用逗号分隔符格式化大数。已解决(代码已更新且完全可用)晚上,我有一个来自Double的类型别名Currency。我想用千位之间的逗号打印它。这是我做的:importFoundationtypealiasCurrency=DoubleextensionCurrency{varcredit:Double{returnself}varusd:Double{returnself*0.62}funcdescription()->String{letprice=selfasNSNumberletformatter=NumberFormatter()formatter.numberStyle=.cu

Nginx配置中的log_format

nginx服务器日志相关指令主要有两条log_format,用来设置日志格式access_log,用来指定日志文件的存放路径、格式和缓存大小,可以参考ngx_http_log_module。log_format设置日志格式log_format指令用来设置日志的记录格式,它的语法如下:    log_formatnameformat{format…}其中,name表示定义的格式名称,format表示定义的格式样式。1.log_format有一个默认的、无须设置的main日志格式,如下图所示:2.也可以根据自己的需求,自定义日志的记录格式,但是名称不能重复log_formatmain'$remot

swift - AVAudioSession : microphone headphone as input and iphone speaker as output

在iOS10中有更多的可能性来管理AUdioSession,但是我无法在音频通过iphone扬声器输出时保持耳机麦克风作为输入。下面的'overrideOutputAudioPort'方法也将输入音频端口覆盖为iphone麦克风letsession=AVAudioSession.sharedInstance()do{trysession.setCategory(AVAudioSessionCategoryPlayAndRecord)try!session.overrideOutputAudioPort(.speaker)}catch{}有什么解决方案可以让耳机一直作为输入吗?