我试图想出一个将经历一个弹簧的循环,一旦它到达%字符,它就会将%之后的所有内容传递给hexToInt函数.这就是我想出来的.
for(int x=0; x<temp.length(); x++)
{
if(temp.charAt(x)=='%')
{
newtemp = everthing after '%'
hexToInt(newtemp);
}
}
Run Code Online (Sandbox Code Playgroud)
试试这个:
newtemp = temp.substring(x+1);
Run Code Online (Sandbox Code Playgroud)
此外,您应该在'%'找到角色后休息.实际上,整个代码段可以像这样实现(不需要为它编写循环!):
String newtemp = temp.substring(temp.indexOf('%')+1);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
94 次 |
| 最近记录: |