Asc
Result = Asc(InputString$)
 
Parameters:

    InputString$ = The string you to get the ASC II code from
Returns:

    Result = The Asc II value that represents this character
 

      The Asc() function takes the Input string and returns the 8bit ASC II character value that represents the first character within that string.



FACTS:


      * Asc() will only return the ASCII code of the first character in the string, any others will be ignored

      * Asc will return a -1 value if the Input string is Null (the string you passed it was empty)

      * If you want to get the ASCII code of other characters in a string and not just the first character, use the MID() function.




Mini Tutorial:


  
; Display the ASC code of the "a" character.
  Print Asc("a")
  
; Display the Asc codes for the string "Hello World"
  S$="Hello World"
  For lp =1 To  Len(s$)
     c$=Mid$(s$,lp,1)
     Print Asc(c$)
  Next lp
  
; Display the screen and wait for a key press
  Sync
  WaitKey
  



This example would output.

  
  97
  72
  101
  108
  108
  111
  32
  87
  111
  114
  108
  100
  


 
Related Info: chr$ | Mid | Mid$ :
 


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