Hey guys, I'm trying to run a for loop through a specific section of a vector using indexOf and lastIndexOf. The problem is that the vector is filled with a bunch of "User" classes, and that I'm differentiating between them by a string inside the class, "advisor." This makes using indexOf and lastIndex of tricky, I feel like it should be possible to do but I have no idea what the notation would look like. I wrote this code, not expecting it to work (it didn't), but here it is anyway:
everything should be self explanatory, aFind is a String I defined inside my application, its value is completely irrelevant for now. If this is actually possible could someone walk me through the proper notation? Thanks. Oh, the vector has been bubble sorted based on the advisor string already, so all the Users with the value for advisor I'm looking for are in between the first and last index of Users with the specified advisor string.Code:for(int start = user.indexOf(User.advisor=aFind); start<(user.lastIndexOf(User.advisor=aFind)+1); start++)