VBA/Excel/Access/Word/String Functions/Left

Материал из VB Эксперт
Перейти к: навигация, поиск

Left() - A portion of a string beginning from the left side

 
Sub InstrLeft()
    Dim userName As String
    Dim firstName As String
    Dim spaceLoc As Integer
    userName = "First Last"
    spaceLoc = InStr(1, userName, " ")
    firstName = Left(userName, spaceLoc - 1)
    Debug.Print firstName
End Sub



Left() Returns a substring from the left side of a string.

 
Sub strDemo5()
   Debug.Print Left("Test", 2)
End Sub