You don't want a girl like that in the first place. If a girlfriend cheats on you, it means you're lucky to have found out she was dishonest and adulterous before you actually got hitched. You haven't lost anything, though, I recommend you start looking for higher-quality women somewhere different than where you found those other ones.
It's a combo of bad choices in females and you being a nice guy (if you are bad one). You need some introspection, and figure out where you may be going wrong. Remember, you can't chance others behavior, only your own.
You're friends are wrong. I would look back and see what the issue was that caused them to cheat. Were they just not into the relationship? Were you too insecure and drove them away? These things can play a role in it more than just being a nice guy