I'm using the Moovweb SDK and I'd like to remove excess white space from the beginning or end of any elements. It sometimes shows up as or and I want to remove it since it messes with my spacing. How can I get around doing this?
Thanks.
You can use regex to replace the leading and tailing whitespace with nothing.
Inside a tag, you can open up a text scope and use the replace(...)
function to replace leading and trailing whitespace:
text() {
replace(/^\s+|\s+$/, "")
}
Here's a working example in play.tritium.io:
http://play.tritium.io/648c6b2f72266b7b7db308e14dcb85f71707f4ee
text(" I'm an example ")
text() {
trim()
}
can also be used to remove white spaces
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.