in reply to sprintf not acting like I expect

"it's not working."

Sorry, that's not enough info to take the trouble to try to help you.

It's not as if you're a noob: you've been here 10 years; long enough to know what follows: Tell us 'what's not working; how it's not working (exact warning and/or error messages, if any) and how whatever is happening is at variance with your expectations, desires.'

And, instead of posting several hundred lines of code (TL,DR), pare your code down to a runnable snippet that still fails in the same manner.



Questions containing the words "doesn't work" (or their moral equivalent) will usually get a downvote from me unless accompanied by:
  1. code
  2. verbatim error and/or warning messages
  3. a coherent explanation of what "doesn't work actually means.