String length with new line
807598Sep 27 2006 — edited Sep 27 2006Hello
I post this in jsp but I think this one is more suitable:
I have a Form that allows user to fill in. In that form, I have an address field (textarea).
Now I want to know the length of this address. I uses
String size = addressField.length();
The size is correct if I have only one line in the address. But if I enter an adress with multi-line, the size is much more than what I count (by hand) even I add one value for each line.
For example, if address "Wellington" has one line as:
Wellington
It can be seen that the size is: 10
But if I enter this in multi lines:
W
e
ll
ing
ton
It can be seen that, by counting, the size is 14 (10+4=14)
However, I get the value of addressField.length() is 18
How I should get value for only 14
Many thanks
shoa