Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的应用程序需要存储和显示用户上传的图像,但是当图像的名称中有空格(或任何导致无效 url 的字符)时,它不会显示在网页中。
grails 生成的 HTML 保留了名称中的空格。我什至无法通过将空格替换为%20(错误 404,但图像确实存在,如果我删除空间,我可以访问它)直接进入图像
%20
试图强制编码是没有用的,因为它仍然保留空格:
<g:img dir="someDir" file="${ image.encodeAsURL() }"/>
我能做些什么来解决这个问题?
我花了大约三个小时试图了解如何"(?<!^)(?=[A-Z])"根据大写字母在tring处拆分工作,即
"(?<!^)(?=[A-Z])"
string[] s = Regex.Split("TheWorldWithoutStrangers", "(?<!^)(?=[A-Z])");
它是如何工作的 !!我确实理解上述表达式中每个字符的