logo
  • 教程列表
  • SO官方文档
  • NSURL
    • 如何从 NSURL String 中获取最后一个字符串组件
    • 如何从 Swift 中的 URL(NSURL) 获取最后一个字符串组件
  1. StackOverflow 文档
  2. iOS 教程
  3. NSURL
  4. 如何从 Swift 中的 URL(NSURL) 获取最后一个字符串组件

如何从 Swift 中的 URL(NSURL) 获取最后一个字符串组件

Created: November-22, 2018

Swift 2.3

let url = NSURL(string: "http://google.com/lastPath")
let lastPath = url?.lastPathComponent

Swift 3.0

  let url = URL(string: "http://google.com/lastPath")
  let lastPath = url?.lastPathComponent
  • 如何从 NSURL String 中获取最后一个字符串组件

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明