Left$
ReturnString$ = Left$(SourceString$, Length)
 
Parameters:

    SourceString$ = The string you wish to grab the leading (left most) Characters from
    Length = The number of characters to grab, starting from the left side.
Returns:

    ReturnString$
 

      Left$ grabs the left part of the source string$ (the HEAD) starting at character one and moving across to the right, the number of characters we select.




FACTS:


      * If the Length parameter is equal to or higher than the string length, then the source string is returned.





Mini Tutorial:



  
  
; Display the left most part of the hello..
  For lp =1 To 5
     Print Left$("Hello",lp)
  Next
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  


This example would output.

  
  H
  He
  Hel
  Hell
  Hello
  




 
Example Source: Download This Example
; ----------------------------------------------
; Left$ EXAMPLE
; ----------------------------------------------
  
; Create a String Variable called "SourceString$" and place the text "Play Basic" within it.
  SourceString$= "Play Basic"
  
; Grab the first four characters from SourceString$ using LEFT$() then place those
; Characters into the variable Grab$
  
  Grab$=Left$(SourceString$,4)
  
; Display the SourceString$ variable
  Print SourceString$
  
; Display the Grab$ variable..
  
  Print Grab$
  
; Show Us the Screen And Wait For Key Input before ending
  Sync
  WaitKey
  
  
  
  
 
Related Info: CutLeft$ | CutRight$ | Mid | mid$ | Right$ | Trim$ | TrimLeft$ | TrimRight$ :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com