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

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -