ios - Replace extension of a filename in swift -
given string format filename.fileextension
want replace fileextension newextension
. how can it?
in java be
foo.substring(0, foo.lastindexof(".")) + ".newextension"
stringbyappendingpathextension
no longer works in swift 2.0 (if using string
). does still work nsstring
. can do:
var storepath = (nssearchpathfordirectoriesindomains(.documentdirectory , .userdomainmask, true)[0]) nsstring storepath = storepath.stringbyappendingpathextension("model.sqlite")!
Comments
Post a Comment