Reputation: 89
I am trying to filter an object type list based on a string value which is working fine, but now I need to filter based on an integer attribute of the objects on the list.
Say the object.name is "name", so when I start typing just "na" the filters works properly, but for the integer filter I cannot figure it out. It just filters when the user inputs the entire number.
return objectList.filter { it.name.contains(filter) || it.pCode == filter.toInt() }
I know that the way is comparing "==" only returns when is equal, but I do not know something like contains but for numbers.
Upvotes: 0
Views: 398