Oxygen Basic

Programming => Problems & Solutions => Topic started by: Arnold on February 28, 2015, 03:08:23 AM

Title: Question about Input() in console.inc
Post by: Arnold on February 28, 2015, 03:08:23 AM
Hi Charles,

in console.inc the input() function does not consider the cr codes. Is this intended? If yes, I will respect this in my little project.

Roland

Code: OxygenBasic
  1. include "$/inc/console.inc"
  2.  
  3. printl "Your name? "
  4. a = Input()
  5. print "Length of your name: " len(a)
  6.  
  7. b = left(a, instr(a, chr(10))-1)
  8. c = left(a, instr(a, chr(13))-1)
  9.  
  10. printl "Maybe length is: " len(b)
  11. printl "But length could also be: " len(c)
  12. printl cr cr
  13. print "Enter ..."
  14.  
  15. waitkey
  16.  
Title: Re: Question about Input() in console.inc
Post by: Charles Pegge on February 28, 2015, 04:39:30 AM
Hi Roland,

You can clean up the raw input like this:

a = ltrim rtrim Input
Title: Re: Question about Input() in console.inc
Post by: Arnold on February 28, 2015, 04:49:07 AM
This works fine. Thank you.