问题
I can use fn:length(mystring)
to find the length/number of character of a string.
How can I find the length/number of digits in an integer?
e.g. if my int is 3000, I want to return 4.
回答1:
Convert it to String
first by evaluating it as body of <c:set>:
<c:set var="intAsString">${someInt}</c:set>
Then you can get its length the usual way:
${fn:length(intAsString)}
来源:https://stackoverflow.com/questions/10343203/how-to-find-length-of-an-integer-in-jsp