You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
512 B
22 lines
512 B
//
|
|
// String+Extension.swift
|
|
// TournamentStats
|
|
//
|
|
// Created by Laurent Morvillier on 02/10/2021.
|
|
// Copyright © 2021 Stax River. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension String {
|
|
|
|
func slice(from: String, to: String) -> String? {
|
|
|
|
return (range(of: from)?.upperBound).flatMap { substringFrom in
|
|
(range(of: to, range: substringFrom..<endIndex)?.lowerBound).map { substringTo in
|
|
String(self[substringFrom..<substringTo])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|