【发布时间】:2011-01-18 15:15:11
【问题描述】:
我有以下字符串:
oauth_token=safcanhpyuqu96vfhn4w6p9x&**oauth_token_secret=hVhzHVVMHySB**&application_name=Application_Name&login_url=https%3A%2F%2Fapi-user.netflix.com%2Foauth%2Flogin%3Foauth_token%3Dsafcanhpyuqu96vfhn4w6p9x
我正在尝试解析 oauth_token_secret 的值。我需要从等号 (=) 到下一个 & 号 (&) 的所有内容。所以我需要解析出:hVhzHVVMHySB
目前,我有以下代码:
Const.OAUTH_TOKEN_SECRET = "oauth_token_secret";
Const.tokenSecret =
content.substring(content.indexOf((Const.OAUTH_TOKEN_SECRET + "="))
+ (Const.OAUTH_TOKEN_SECRET + "=").length(),
content.length());
这将从 oauth_token_string 的开头开始,但不会在下一个 & 符号处停止。我不确定如何指定在以下&符号的末尾停止。谁能帮帮我?
【问题讨论】: