News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Manually Convert ASCII String to lower case ASCII string

Started by kevin, March 14, 2022, 08:51:20 PM

Previous topic - Next topic

kevin

    Learn To Code: Manually Convert ASCII String to lower case ASCII string


   Functions Used:  Chr$() , ASC() and Mid()


PlayBASIC Code: [Select]
   Message$ = "Hello World"


// Manually Convert ASCII String to lower case ASCII string
For lp=1 to Len(Message$)

// Read the ASCII character code from this position
// in the string
ThisCHR = mid(Message$,lp)

// Check if this Chr is an upper case character code ?
if ThisCHR=> asc("A") and ThisCHR=< asc("Z")

// if it is, then we manually convert this to lower case
ThisCHR = asc("a")+(THisCHR-asc("A"))

endif

// convert ThisCHR (ascII value) to a chr$ and append to RESULT$
Result$+= chr$(ThisCHR)
next

// display both messages
print Message$
print Result$

Sync
waitkey





   Tags: Learn To Code, Learn Programming, Learn BASIC,   String Functions