我需要帮助在空格("")中在javascript中拆分字符串,忽略引号表达式中的空格.
我有这个字符串:
var str = 'Time:"Last 7 Days" Time:"Last 30 Days"';
Run Code Online (Sandbox Code Playgroud)
我希望我的字符串被拆分为2:
['Time:"Last 7 Days"', 'Time:"Last 30 Days"']
Run Code Online (Sandbox Code Playgroud)
但我的代码分为4:
['Time:', '"Last 7 Days"', 'Time:', '"Last 30 Days"']
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
str.match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
Run Code Online (Sandbox Code Playgroud)
谢谢!
我正在尝试为批准我的应用程序的用户获取文件和文件夹(现在我在他批准后拥有令牌)。
我能够通过获取用户 dbid 并将其与“Dropbox-API-Select-User”标头一起使用来扫描团队中的所有用户,但有时我只想扫描当前用户(批准我的应用程序的用户)。
我暂时无法获得他的 dbid,当我尝试在没有“Dropbox-API-Select-User”标头的情况下访问“ https://api.dropboxapi.com/2/users/get_current_account ”时,我得到了消息表明此标头丢失。
有什么想法如何在没有 dbid 的情况下访问他的文件/文件夹,或者以某种方式获取他的 dbid?也许在授权过程中?或者其他一些API?
我正在使用这个 API: https: //www.dropbox.com/developers/documentation/http/documentation
我获取当前帐户的请求:https ://api.dropboxapi.com/2/users/get_current_account
我的标题:
内容类型:application/json
授权:不记名 my_token
我收到此错误:调用 API 函数“users/get_current_account”时出错:缺少必需的 X-Dropbox-Perform-As-Team-Member 标头
谢谢。
我使用的V2 HTTP API:https://www.dropbox.com/developers/documentation/http/documentation 我试图职位:https://api.dropboxapi.com/2/files/get_metadata 为根文件夹。
我的请求正文: {"path":""}
我的标题:
Content-Type: application/json
Authorization: Bearer my_token
Dropbox-API-Select-User: dbmid:some_user_id
Run Code Online (Sandbox Code Playgroud)
我收到身体的响应代码 400:
Error in call to API function "files/get_metadata":
request body: path: '' did not match pattern '((/|id:).*)|(rev:[0-9a-f]{9,})'
Run Code Online (Sandbox Code Playgroud)
发送一个空的 json 也不起作用。
当我尝试访问非 root 文件夹时,它可以工作(例如:“/111”)。
在“路径格式”部分的文档中,它说:“空字符串(“”)代表根文件夹”。
我究竟做错了什么?
谢谢!