如何将fileurl(swift)转换为已编码的utf8十六进制?

时间:2019-04-10 07:48:56

标签: swift bash hex

我只想像下面的swift代码那样将fileURLWithPath转换为utf8十六进制格式。

import Cocoa
// this swift file name is aaa.swift
let arguments = CommandLine.arguments
let str = "\(arguments)"
let url = URL(fileURLWithPath: str)
print(url)

我将bash路径变量发送到aaa.swift文件。像下面 path =“ / Volumes / aaa / ccc.mov”

swift aaa.swift $path 

然后在如下所示的终端上打印

%5B%22./aaa.swift%22,%20%22/Volumes/aaa/ccc.mov%22%5D -- file:///Volumes/aaa/

我想获得“ /Volumes/aaa/ccc.mov”这一部分.. 怎么做??

0 个答案:

没有答案
相关问题