mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-05-09 06:38:24 +08:00
22 lines
444 B
Swift
22 lines
444 B
Swift
//
|
|
// String+QueryItemValue.swift
|
|
// Freetime
|
|
//
|
|
// Created by Ryan Nystrom on 7/8/17.
|
|
// Copyright © 2017 Ryan Nystrom. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension String {
|
|
|
|
func valueForQuery(key: String) -> String? {
|
|
guard let items = URLComponents(string: self)?.queryItems else { return nil }
|
|
for item in items where item.name == key {
|
|
return item.value
|
|
}
|
|
return nil
|
|
}
|
|
|
|
}
|