We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Because Inja now offers several useful function it would be great to add also functions to convert string to number.
I currently have these functions named double(x) and integer(x) with following test
double(x)
integer(x)
nlohmann::json data; data["val1"] = "5"; data["val2"] = "-5"; InjaStringType res = inja::render("{%if integer(val1) >= 0%}yes{%else%}no{%endif%}", data); TEST_CHECK_EQUAL(res, "yes"); res = inja::render("{%if integer(val1) < 0%}yes{%else%}no{%endif%}", data); TEST_CHECK_EQUAL(res, "no"); res = inja::render("{%if double(val2) >= 0%}yes{%else%}no{%endif%}", data); TEST_CHECK_EQUAL(res, "no"); res = inja::render("{%if double(val2) < 0%}yes{%else%}no{%endif%}", data); TEST_CHECK_EQUAL(res, "yes");
Are you interested in such PR?
The text was updated successfully, but these errors were encountered:
Already done!
Sorry, something went wrong.
Thanks!
No branches or pull requests
Because Inja now offers several useful function it would be great to add also functions to convert string to number.
I currently have these functions named
double(x)
andinteger(x)
with following testAre you interested in such PR?
The text was updated successfully, but these errors were encountered: