I don't have much experience with the idStr class but from what I can see you could try something like this.
idStr filePath = "C:/Doom3/mod_folder/icon.ico";
idStr compareTo = "icon.ico";
idStr fileName;
filePath.ExtractFileName( fileName );
if ( fileName == compareTo ) {
// icon file found
} else {
// icon file not found!
}
Sorry about the code formatting.
Thank you that helped.

No need to ask for sorry about that, i'm still learning to code so my code is pretty much a mess, i'm sure that one year from now i will look back and say, how dumb i was!

I also found out after your help that you can also remove the path and the extension from a file name very easily, in that way you also end with just the desired string:
Example:
idStr iconType;
iconType = item->GetString("inv_icon"); // "guis/assets/pda/inventory/inventory_battery.tga"
iconType.StripPath(); // inventory_battery.tga
iconType.StripFileExtension(); // inventory_battery