trim()
功能
去掉字符串起始和结尾的空格。
语法
langx.trim(str)
参数
- str
需被修整的字符串
范例
Example: 删除在开始和在字符串的末尾两个空格。
<!DOCTYPE html> <html> <head> <style> </style> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min.js"></script> <script> require.config({ baseUrl: "./", packages: [{ name: "skylark", location: "../../../src/skylark" }, ] }); </script> </head> <body> <span></span> <script> require(["skylark/finder", "skylark/langx", "skylark/datax"], function(finder, langx, datax) { datax.text(finder.find("span"), langx.trim(" hello, how are you? ")); }); </script> </body> </html>