Re: [swift-users] hasSuffix(_:) and .hasPrefix(_:) String methods missing on Linux

2015-12-11 Thread Alessandro Morgantini via swift-users
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: St

Re: [swift-users] hasSuffix(_:) and .hasPrefix(_:) String methods missing on Linux

2015-12-11 Thread Alex Blewitt via swift-users
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. A

Re: [swift-users] hasSuffix(_:) and .hasPrefix(_:) String methods missing on Linux

2015-12-11 Thread Alex Blewitt via swift-users
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 > wrote: > > Hello to everyone! > I'm a very newbie to Swift, I'm doing first experiments on Linux & Mac and I > have the

[swift-users] hasSuffix(_:) and .hasPrefix(_:) String methods missing on Linux

2015-12-11 Thread Alessandro Morgantini via swift-users
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 'Strin