WerWolv / ImHex-Patterns

Hex patterns, include patterns and magic files for the use with the ImHex Hex Editor
https://github.com/WerWolv/ImHex
GNU General Public License v2.0
662 stars 176 forks source link

fix: [ImHex Bug] std::string::replace("aa", "aa", "") returns "a" #1408 #198

Closed paxcut closed 11 months ago

paxcut commented 11 months ago

The previous fixes for this function didn't consider the case when the resulting string has a contribution from the original string that occurs after all the substitutions have been made and that is longer than the replacement string. This PR resolves that issue and also addresses the case where one or more of the inputs is empty. Please see discussion on ImHex issue #1408 for details.

WerWolv commented 11 months ago

Thank you!