I’m using string.contains(“string”) to look for partitions in proc files. Line examples would be:
8 0 sda 64154 32861 2927936 1462960 222942 512949 5776720 4355320 0 1029440 5818130
8 1 sda1 29613 26082 1943594 1077290 23561 82884 851560 423330 0 235650 1500640
I have a string array. Each line is a element of the array. As some elements are not usefull, I check for the partitions name in the line. If a line has the name of one the existing partitions, it will be parsed.
That’s why I cannot simple use string.equals; I can check if the line contains and then do some string manipulation with indexOf maybe, using then equals.
Thanks, sorry for not being clearer before.
Is this as simple as you trying to check if two strings are equal, rather than a containment check? If so all you need is:
instead of
If that’s not what you’re after, you need to be clearer in your question.
EDIT (after the question update): It’s still not really clear what you’re trying to do. It sounds like you may be able to get away with:
as this will not match
sda1. Basically, take advantage of the fact that there’s a space before and after the partition name, but there can’t be one in the partition name.