Clear. For my needs, this chunk of code at the beginning of my file is sufficient:
#if !_runtime(_ObjC) extension String { public func hasPrefix(prefix: String) -> Bool { return prefix == String(self.characters.prefix(prefix.characters.count)) } public func hasSuffix(suffix: String) -> Bool { return suffix == String(self.characters.suffix(suffix.characters.count)) } } #endif Thank you guys! On Fri, Dec 11, 2015 at 12:51 PM, Alex Blewitt <alex.blew...@gmail.com> wrote: > FYI: > > > https://github.com/apple/swift/blob/master/stdlib/public/core/StringLegacy.swift#L73 > > These two functions are (currently) only available with the Objective-C > bridge, which the Linux port doesn’t have. > > Alex > > On 11 Dec 2015, at 11:48, Alex Blewitt <alex.blew...@gmail.com> wrote: > > They may come as extensions from NSString, which Swift doesn’t have fully > implemented on Linux yet. > > Alex > > On 11 Dec 2015, at 11:18, Alessandro Morgantini via swift-users < > swift-users@swift.org> wrote: > > Hello to everyone! > I'm a very newbie to Swift, I'm doing first experiments on Linux & Mac and > I have the following issue: if I call the hasSuffix(_:) or the > hasPrefix(_:) methods on a String instance, I obtain the following error: > > $ swiftc prova.swift > prova.swift:110:4: error: value of type 'String' has no member 'hasSuffix' > if pippo.hasSuffix("ao") { > ^~~~~ ~~~~~~~~~ > > Same code works well on OS X. > I'm using Ubuntu 14.04 with required dependencies (clang and libicu-dev) > installed. > Any idea? > > Cheers, Alessandro > > -- > Ing. Alessandro Morgantini - http://www.morgantini.org/ > Email: gpz...@technologist.com > Cell.: +39-347 761 1221 - Fax: +39-390 347 761 1221 > _______________________________________________ > swift-users mailing list > swift-users@swift.org > https://lists.swift.org/mailman/listinfo/swift-users > > > > -- Ing. Alessandro Morgantini - http://www.morgantini.org/ Email: gpz...@technologist.com Cell.: +39-347 761 1221 - Fax: +39-390 347 761 1221
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users