Sprinter
Sprinter copied to clipboard
Strings with '%' symbols which aren't token placeholders don't format correctly
For instance the following:
"%s 0% fat Greek style yogurt"
when formatted with:
"60ml"
should ideally result in:
"60ml 0% fat Greek style yogurt"
Instead the outcome is nil
I've taken a look over the code and this could be fixed by tweaking line 587 in Sprinter.swift
:
if first == "%" { break }
to become:
if first == "%" {
if string.last == nil || string.last == " " {
break
}
}
I've tested this locally and all unit tests pass with the change (as well as this new case). I'm happy to create a PR? Let me know, cheers.