如何搜索字符串數組項目元素中的特定文本?以下是xml文件的一個例子。字符串數組名稱是android。我有一些項目內的字符串數組。現在我想搜索「軟件」這個詞。請告訴我該怎麼做?在字符串數組項目元素中搜索字符串
<?xml version="1.0" encoding="utf-8"?><resources>
<string-array name="android">
<item>Android is a software stack for mobile devices that includes an operating system, middleware and key applications.</item>
<item>Google Inc. purchased the initial developer of the software, Android Inc., in 2005..</item>
</string-array>
這不會做OP想要的,哪些(基於發佈的例子)是找到包含_inctain_單詞「software」的列表元素。這隻會找到_equal_(全部)單詞「軟件」的元素。此外,'List.contains'在內部使用循環;它不會比在你自己的代碼中使用循環更快。另外你還需要額外的在'String []''周圍創建'List'包裝。 –
它可以用於自定義對象列表嗎? – ralphgabb