Trim [AHK_L 31+]
移除字符串的开始和/或末尾的某些字符.
Result := Trim(String, OmitChars = " `t")
Result := LTrim(String, OmitChars = " `t")
Result := RTrim(String, OmitChars = " `t")
参数
- String
任何字符串值或变量. 不支持数字.
- OmitChars
可选的字符列表 (区分大小写), 用来从 String 的开始和/或结尾部分移除这些字符. 如果省略, 则移除空格和 tab.
示例
text := " text "
MsgBox % "No trim:`t '" text "'"
. "`nTrim:`t '" Trim(text) "'"
. "`nLTrim:`t '" LTrim(text) "'"
. "`nRTrim:`t '" RTrim(text) "'"
MsgBox % LTrim("00000123","0")