mirror of
https://github.com/samsonjs/SwiftBatteries.git
synced 2026-03-25 09:25:51 +00:00
initial commit with a String extension
This commit is contained in:
commit
70a0bf9ec0
3 changed files with 19 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
.build
|
||||
5
Package.swift
Normal file
5
Package.swift
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "Batteries"
|
||||
)
|
||||
13
Sources/String.swift
Normal file
13
Sources/String.swift
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import Foundation
|
||||
|
||||
public extension String {
|
||||
|
||||
func contains(substring: String) -> Bool {
|
||||
return rangeOfString(substring) != nil
|
||||
}
|
||||
|
||||
func trim() -> String {
|
||||
return stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet())
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue