On a project I work on, we recently ran into the issue where we need to check if 2 strings have string formatting, (for translations).
/* A simple example: */
str = "%.200sSOMETEXT%.5fSOMEMORETEXT%d%ul%.*s%%";
/* Should be able to be validated to be the equivalent of: */
str = "%.200sBLAHBLAH%.5ftest%d%ul%.*s%%MORETEXT";
/* and... */
str = "%.200s%.5f%d%ul%.*s%%";
/* but not... */
str = "%.5f%.200s%d%ul%%%.*s";
So my question is:
Is there a way to validate 2 strings have equivalence string formatting?
Perhaps the answer is some very good regex expression, or existing tools or some example code from another project. I can't imagine we're the first project to run into this problem.