Trim / LTrim / RTrim

文字列の先頭や末尾から文字を切り取ります。

NewString :=  Trim(String , OmitChars)
NewString := LTrim(String , OmitChars)
NewString := RTrim(String , OmitChars)

パラメータ

String

型:文字列

任意の文字列値または変数。数字はサポートされていない。

OmitChars

型:文字列

省略した場合、スペースとタブは削除される。Otherwise, specify a list of characters (case-sensitive) to exclude from the beginning and/or end of String.

戻り値

型:文字列

これらの関数は、指定された文字列を切り詰めたものを返します。

文字列の左右の空白をすべて取り除きます。

text := "  text  "
MsgBox
(
    "No trim:`t'" text "'
    Trim:`t'" Trim(text) "'
    LTrim:`t'" LTrim(text) "'
    RTrim:`t'" RTrim(text) "'"
)

文字列の左側からすべてのゼロをトリムする。

MsgBox LTrim("00000123", "0")