user3756: I want to send text over serial monitor to Arduino and make Arduino return that string back to me over serial monitor.
I have made this function which reads from serial input and returns a string object.
String readSerial() {
    String input;
    while(Serial.available() > 0)
        input.concat(Serial.read());
    return input;
}

In the loop() I have:
if(Serial.available()) Serial.print(readSerial());

If I just do something like Serial.print("Hello world!"); everything is fine. But, if I try to return string object I get lot's of numbers.
I guess Serial.print doesn't know how to read String object and returns ASCII codes of characters or something?
[update]
I have checked it, and it's indeed outputing ASCII codes. For Hi I get 72105.
[update]
I have updated my readSerial function to use this :
input += (char)Serial.read();

But now I'm getting carriage return and new line after every character:
[SEND] Hi
H(CR)
i(CR)

So, how can I make it return my text so that is readable?

user368: String.concat() takes a String as the second argument. Serial.read() returns an int. The compiler creates code that converts the int into a String similar to this:
input.concat(String(Serial.read()));

This is not what you want.
Let's tell the compiler what you really want instead:
input.concat((char)Serial.read());

This will tell the compiler to do the following:
input.concat(String((char)Serial.read()));

We are now having the compiler call the correct String constructor, and the code will work as we expect.

3756: <p>I want to send text over serial monitor to Arduino and make Arduino return that string back to me over serial monitor.</p>

<p>I have made this function which reads from serial input and returns a string object.</p>

<pre><code>String readSerial() {
    String input;
    while(Serial.available() &gt; 0)
        input.concat(Serial.read());
    return input;
}
</code></pre>

<p>In the <code>loop()</code> I have:</p>

<pre><code>if(Serial.available()) Serial.print(readSerial());
</code></pre>

<p>If I just do something like <code>Serial.print("Hello world!");</code> everything is fine. But, if I try to return string object I get lot's of numbers.</p>

<p>I guess <code>Serial.print</code> doesn't know how to read <code>String</code> object and returns ASCII codes of characters or something?</p>

<p><strong>[update]</strong>
I have checked it, and it's indeed outputing ASCII codes. For <code>Hi</code> I get <code>72105</code>.</p>

<p><strong>[update]</strong>
I have updated my <code>readSerial</code> function to use this :</p>

<pre><code>input += (char)Serial.read();
</code></pre>

<p>But now I'm getting carriage return and new line after every character:</p>

<pre><code>[SEND] Hi
H(CR)
i(CR)
</code></pre>

<p>So, how can I make it return my text so that is readable?</p>
 368: <p><code>String.concat()</code> takes a <code>String</code> as the second argument. <code>Serial.read()</code> returns an <code>int</code>. The compiler creates code that converts the <code>int</code> into a <code>String</code> similar to this:</p>

<pre><code>input.concat(String(Serial.read()));
</code></pre>

<p>This is not what you want.</p>

<p>Let's tell the compiler what you really want instead:</p>

<pre><code>input.concat((char)Serial.read());
</code></pre>

<p>This will tell the compiler to do the following:</p>

<pre><code>input.concat(String((char)Serial.read()));
</code></pre>

<p>We are now having the compiler call the correct <code>String</code> constructor, and the code will work as we expect.</p>
