From 4254364b74fdcbd96bb2cbe3b768c2aac4359cb3 Mon Sep 17 00:00:00 2001 From: Kare Morstol Date: Wed, 5 Nov 2014 23:57:58 +0100 Subject: [PATCH] This indentation was brought to you by Xcode (6.1). --- SwiftShell/Pipes.swift | 42 +++++++++++++++--------------- SwiftShell/String.swift | 10 +++---- SwiftShellTests/String_Tests.swift | 8 +++--- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/SwiftShell/Pipes.swift b/SwiftShell/Pipes.swift index 95d58cf..73f5f5c 100644 --- a/SwiftShell/Pipes.swift +++ b/SwiftShell/Pipes.swift @@ -21,25 +21,25 @@ public func |> (lhs: T, rhs: T -> U) -> U { } /** Lazily return a sequence containing the elements of source, in order, that satisfy the predicate includeElement */ -public func filter +public func filter (includeElement: (S.Generator.Element) -> Bool) (source: S) -> LazySequence> { - + return lazy(source).filter(includeElement) } /** -Return an `Array` containing the sorted elements of `source` according to 'isOrderedBefore'. +Return an `Array` containing the sorted elements of `source` according to 'isOrderedBefore'. -Requires: `isOrderedBefore` is a `strict weak ordering +Requires: `isOrderedBefore` is a `strict weak ordering ` over `elements`. */ public func sorted (isOrderedBefore: (S.Generator.Element, S.Generator.Element) -> Bool) (source: S) -> [S.Generator.Element] { - + return sorted(source, isOrderedBefore) } @@ -48,19 +48,19 @@ public func map (transform: (S.Generator.Element) -> T) (source: S) -> LazySequence> { - + return lazy(source).map(transform) } -/** -Return the result of repeatedly calling combine with an accumulated value +/** +Return the result of repeatedly calling combine with an accumulated value initialized to initial and each element of sequence, in turn. */ public func reduce (initial: U, combine: (U, S.Generator.Element) -> U) (sequence: S) -> U { - + return reduce(sequence, initial, combine) } @@ -72,9 +72,9 @@ public func split (_ delimiter: String = "\n")(text: String) -> [String] { /** Insert separator between each item in elements. */ public func join (separator: C) - (elements: S) + (elements: S) -> C { - + return join(separator, elements) } @@ -88,7 +88,7 @@ public func drop LazySequence> { - + return sequence |> filter { !contains(tobedropped, $0) } } @@ -96,14 +96,14 @@ public func drop (numbertotake: Int)(sequence: S) -> [T] { - var generator = sequence.generate() - var result = [T]() - for _ in 0.. String { return self.stringByReplacingOccurrencesOfString(replaceOldString, withString: withString) } - + public func split (sep: String) -> [String] { return self.componentsSeparatedByString(sep) } - + public func trim () -> String { return self.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()) } @@ -42,17 +42,17 @@ extension String { }) } - /** + /** Split the string at the first occurrence of separator, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is - not found, return a 3-tuple containing the string itself, followed by two empty strings. + not found, return a 3-tuple containing the string itself, followed by two empty strings. */ public func partition (separator: String) -> (String, String, String) { if let separatorRange = self.rangeOfString(separator) { if !separatorRange.isEmpty { let firstpart = self[self.startIndex ..< separatorRange.startIndex] let secondpart = self[separatorRange.endIndex ..< self.endIndex] - + return (firstpart, separator, secondpart) } } diff --git a/SwiftShellTests/String_Tests.swift b/SwiftShellTests/String_Tests.swift index 0c74a77..ed40654 100644 --- a/SwiftShellTests/String_Tests.swift +++ b/SwiftShellTests/String_Tests.swift @@ -1,9 +1,9 @@ // -// String_Tests.swift -// SwiftShell +// String_Tests.swift +// SwiftShell // -// Created by Kåre Morstøl on 04.11.14. -// Copyright (c) 2014 NotTooBad Software. All rights reserved. +// Created by Kåre Morstøl on 04.11.14. +// Copyright (c) 2014 NotTooBad Software. All rights reserved. // import XCTest