mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-05-26 14:47:11 +08:00
24 lines
473 B
Swift
24 lines
473 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 {
|
|
if item.name == key {
|
|
return item.value
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
}
|