Author Topic: Question about Input() in console.inc  (Read 1875 times)

0 Members and 1 Guest are viewing this topic.

Arnold

  • Guest
Question about Input() in console.inc
« 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.  

Charles Pegge

  • Guest
Re: Question about Input() in console.inc
« Reply #1 on: February 28, 2015, 04:39:30 AM »
Hi Roland,

You can clean up the raw input like this:

a = ltrim rtrim Input

Arnold

  • Guest
Re: Question about Input() in console.inc
« Reply #2 on: February 28, 2015, 04:49:07 AM »
This works fine. Thank you.