Grails.How 在项目符号中格式化字符串
Grails.How to format Strings in bullet point
我希望 div 成为 dynamic.The 字符串,我得到的可能包含这样的要点:"Uses •This is a test: •This is a test •This is a test •This is a test •This is a test •This is a test •This is a test •This is a test •This is a test".
我有一个 div 显示输出:
<div class="ds-results-detail-a">${a}</div>
我如何在列表中显示该响应:
Uses
•This is a test:
•This is a test
•This is a test
•This is a test
•This is a test
•This is a test
•This is a test
•This is a test
响应可能包含带有这些要点的字符串,或者可能只是字符串。输出简单地显示如下:
Uses •This is a test: •This is a test •This is a test •This is a test
•This is a test •This is a test •This is a test •This is a test •This
is a test
如何在列表中显示?提前致谢:)
如果我没理解错的话,你需要像这样:
<ul>
<g:each in="${yourString.split( '•' )}" var="s">
<li>${s}</li>
</g:each>
</ul>
更新:
另一种方式:
${yourString.replaceAll( '•', '<br>•' )}
我希望 div 成为 dynamic.The 字符串,我得到的可能包含这样的要点:"Uses •This is a test: •This is a test •This is a test •This is a test •This is a test •This is a test •This is a test •This is a test •This is a test".
我有一个 div 显示输出:
<div class="ds-results-detail-a">${a}</div>
我如何在列表中显示该响应:
Uses
•This is a test:
•This is a test
•This is a test
•This is a test
•This is a test
•This is a test
•This is a test
•This is a test
响应可能包含带有这些要点的字符串,或者可能只是字符串。输出简单地显示如下:
Uses •This is a test: •This is a test •This is a test •This is a test •This is a test •This is a test •This is a test •This is a test •This is a test
如何在列表中显示?提前致谢:)
如果我没理解错的话,你需要像这样:
<ul>
<g:each in="${yourString.split( '•' )}" var="s">
<li>${s}</li>
</g:each>
</ul>
更新:
另一种方式:
${yourString.replaceAll( '•', '<br>•' )}