alexei / sprintf.js

sprintf.js is a complete open source JavaScript sprintf implementation
BSD 3-Clause "New" or "Revised" License
2.11k stars 290 forks source link

Long integer format specifier doesn't work: %ld #213

Closed po1 closed 2 years ago

po1 commented 2 years ago

I'm dealing with format strings that come from a C/C++ program, and they contain long integer format placeholders.

It would be nice if that extra l was handled / ignored, instead of throwing an error.

> const sprintf = require('sprintf-js').sprintf;
undefined
> sprintf('yo: %ld', 42)
Uncaught SyntaxError: [sprintf] unexpected placeholder
alexei commented 2 years ago

I'm dealing with format strings that come from a C/C++ program, and they contain long integer format placeholders.

There's the problem right there