Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
Update String+Sugar.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
steffendsommer authored May 31, 2017
1 parent 089798f commit e36bc31
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Sources/String+Sugar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extension String {
///
/// - Parameter regex: Regex to check for.
/// - Returns: Returns the match (if any).
internal func firstMatch(regex: String) -> String? {
public func firstMatch(regex: String) -> String? {
guard let range = self.range(of: regex, options: .regularExpression) else {
return nil
}
Expand All @@ -27,7 +27,7 @@ extension String {
///
/// - Parameter regex: Regex to check for.
/// - Returns: A list of matches (if any).
internal func matches(regex: String) -> [String] {
public func matches(regex: String) -> [String] {
#if os(Linux)
do {
let regex = try NSRegularExpression(pattern: regex, options: [])
Expand Down Expand Up @@ -58,7 +58,7 @@ extension String {
#endif
}

internal func replace(_ regex: String, with replacement: String) -> String {
public func replace(_ regex: String, with replacement: String) -> String {
var result = self

let matches = self.matches(regex: regex)
Expand All @@ -73,12 +73,12 @@ extension String {
///
/// - Parameter regex: Regex to check for.
/// - Returns: A bool telling if the regex had any matches.
internal func isMatching(regex: String) -> Bool {
public func isMatching(regex: String) -> Bool {
return self.range(of: regex, options: .regularExpression) != nil
}

/// The string being url encoded.
internal func urlEncoded() throws -> String {
public func urlEncoded() throws -> String {
return try percentEncoded(try self.makeBytes()).string()
}
}
Expand All @@ -87,7 +87,7 @@ extension String {
// MARK: - Convenience for optional strings.
extension Optional where Wrapped: ExpressibleByStringLiteral {
/// Falls back to an empty string if no value is found.
internal var safeUnwrap: String {
public var safeUnwrap: String {
guard let string = self as? String else {
return ""
}
Expand Down

0 comments on commit e36bc31

Please sign in to comment.