Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在android中过滤字符串_Android_String - Fatal编程技术网

在android中过滤字符串

在android中过滤字符串,android,string,Android,String,我需要从上面的字符串中获取“要过滤的文本”。 请帮忙。提前感谢。在本例中,您可以使用String.split()方法 String test = "{helloworld=Text to be filtered}"; testAfterSplit[0]将保存值“{helloworld”和 testAfterSplit[1]将保留值“要筛选的文本}” 您可以阅读有关拆分的更多信息您可以使用indexOf方法。它会重新运行您想要的角色位置。在这种情况下: String test = "{hello

我需要从上面的字符串中获取“要过滤的文本”。
请帮忙。提前感谢。

在本例中,您可以使用String.split()方法

String test = "{helloworld=Text to be filtered}";
testAfterSplit[0]
将保存值“{helloworld”和
testAfterSplit[1]
将保留值“要筛选的文本}


您可以阅读有关拆分的更多信息

您可以使用indexOf方法。它会重新运行您想要的角色位置。在这种情况下:

String test = "{helloworld=Text to be filtered}";
String testAfterSplit[] = test.split("=");

它将返回一个从=位置到结尾的字符串。

发布您的尝试。对不起,我是初学者。我不知道。请帮帮我,我感到困惑。请提供帮助。在JSON解析之后,我在ListView中列出了这些项。在获取项值时,我会得到以下类型的字符串:“{helloworld=Text to filter}”。所以我需要得到“要过滤的文本”。我自己得到了答案!String test=“{helloworld=要筛选的文本}”;字符串test2=test.replace(“{helloworld=”,”);字符串test3=test2.replace(“}”,”);现在我可以使用test3string:D了,这就是我自己发现的。
int pos = text.IndexOf("=");
String filter = text.substring(pos, text.length());