# Gets, etc (was RE: Newbie Questions)

**URL:** <https://www.ruby-forum.com/t/gets-etc-was-re-newbie-questions/64210>\
**Category:** Ruby\
**Created:** [June 23, 2006, 3:10am UTC](https://www.ruby-forum.com/t/gets-etc-was-re-newbie-questions/64210 "2006-06-23T03:10:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeSSSSaS\_Botp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ecd19e/32.png) [@PeSSSSaS\_Botp](https://www.ruby-forum.com/u/PeSSSSaS_Botp)\
**Post date:** [June 23, 2006, 3:10am UTC](https://www.ruby-forum.com/t/gets-etc-was-re-newbie-questions/64210/1 "2006-06-23T03:10:07Z")

</div>

fr Azalar:

# Makes sense now that i’ve seen what is happening behind the scenes.

# I come from a Java background but didn’t think to test if it

# was adding carriage returns to the end of the string.

that is a faq but you may have a point.  
others would argue that “hey, i have to enter a newline otherwise you  
wont accept it, and now you’re telling me to chop it off?!”.  
maybe, we can we have #gets2 or #input (for lack of better a word) that  
automatically chops newline if there is one, orthogonal to #puts putting  
one if there is none.

kind regards -botp

---

<div class="post-metadata">

**Author:** ![PeSSSSaS\_Botp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ecd19e/32.png) [@PeSSSSaS\_Botp](https://www.ruby-forum.com/u/PeSSSSaS_Botp)\
**Post date:** [June 23, 2006, 3:34am UTC](https://www.ruby-forum.com/t/gets-etc-was-re-newbie-questions/64210/2 "2006-06-23T03:34:35Z")

</div>

Hi,

At Fri, 23 Jun 2006 10:06:38 +0900,  
Peña, Botp [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote in [ruby-talk:198616]:

> fr Azalar:
> 
> # Makes sense now that i’ve seen what is happening behind the scenes.
> 
> # I come from a Java background but didn’t think to test if it
> 
> # was adding carriage returns to the end of the string.
> 
> that is a faq but you may have a point.  
> others would argue that “hey, i have to enter a newline  
> otherwise you wont accept it, and now you’re telling me to  
> chop it off?!”.

Double Ctrl-D sends a text without a newline.

> maybe, we can we have #gets2 or #input (for lack of better a  
> word) that automatically chops newline if there is one,  
> orthogonal to #puts putting one if there is none.

a) use readline to input  
b) use Regexp to match
