前のトピック: LCase - 大文字の小文字への変換次のトピック: Len - 文字列の長さを取得


Left - 文字列の最も左の文字を返す

NetWare、Symbian OS、UNIX、Windows、および Windows CE で有効です。

Left 関数によって、文字列 str の最も左の文字を含むサブ文字列が返されます。

関数の形式

Left(str as String, n as Integer) as String
str

左のサブ文字列を取得する先の文字列を示します。

n

左のサブ文字列の文字数を示します。

文字列 str で最も左の n 文字を含むサブ文字列が返されます。

例: Left 関数

以下の例では、文字列操作の方法が示されます。

Dim text As String
Text="Unicenter TNG"

Print("Left(text,3) : " + Left(text,3))  'Uni
Print("Mid(text,4,6) : " + Mid(text,4,6)) 'center
Print("Right(text,3) : " + Right(text,3)) 'TNG
Print("Length    : " + Str(Len(text))) '13