问题描述
<%=CMSStringUtility.toTitleCase(attrValues.getDisplayLabel())%>
这将返回一个带有前导空格字符的字符串,我需要将其删除.我相信这是jsp文件中的JAVA.我尝试了以下方法:
this returns a string with a leading white space character that I need to remove. I believe this is JAVA in a jsp file. I tried the following:
<%=CMSStringUtility.toTitleCase(attrValues.getDisplayLabel()).trim()%>
和
<%=CMSStringUtility.toTitleCase(attrValues.getDisplayLabel().trim())%>
我是JSP新手,有什么想法吗?
I am a JSP newbie, any ideas?
推荐答案
如果trim()
没有删除空格,则表示它不在预定义的空格列表中.这通常是一个不间断的空间(代码160).尝试迭代toCharArray()
并查看空格的ascii代码.
If trim()
does not remove a whitespace, it means it is not in the predefined list of whitespaces. This is usually a non-breaking space (code 160). Try to iterate the toCharArray()
and see the ascii code of the space.
这篇关于在Java中修剪字符串,删除空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!