[英]remove leading and traling <br> from a string
I have <br>
inserted into a string using some logic in typescript. 我已经使用打字稿中的某些逻辑将
<br>
插入到字符串中。 I wanted to remove the <br>
at the begining and end of the string. 我想在字符串的开头和结尾处删除
<br>
。 Others should remain as it. 其他人应该保持原样。 What is the best way to achieve?
最好的实现方法是什么?
I achieved it using mystring.substring(mystring.indexOf('<br>'),mystring.lastIndexOf('<br>'))
我使用
mystring.substring(mystring.indexOf('<br>'),mystring.lastIndexOf('<br>'))
实现了它
Want to know if its the optimum way of doing this. 想知道它的最佳方法。
Its a little more complicated.. Should replace all the 它有点复杂..应该替换所有
in the starting of the string and ending of the string. 在字符串的开头和结尾。
<br><br>hello<br>user<br><br><br> should return hello<br>user
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.