A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Java
»
Java in General
Author
character to insert space
vivek ja
Ranch Hand
Joined: Feb 24, 2005
Posts: 80
posted
Apr 25, 2005 09:26:00
0
How can I insert spaces in output
string
?
Similar to \t for tab what is the character for space?
Also is there any site where there is a list of these characters?
K Riaz
Ranch Hand
Joined: Jan 08, 2005
Posts: 375
posted
Apr 25, 2005 09:42:00
0
" "
Ryan McGuire
Ranch Hand
Joined: Feb 18, 2005
Posts: 945
posted
Apr 25, 2005 09:54:00
0
A space between single quotes in the source code is a Space char.
e.g.
String name = "vivek ja"; int spaceIndex = name.indexOf(' ');
If you want something that uses more toner from your laser printer, you could use the C type /xxx escape sequence (where xxx is an octal number).
'\t' = '\011'
' ' = '\040'
Here
is page with the whole list.
TAB is '\t'
CR is '\r'
LF is '\n'
BS is '\b'
FF is '\f'
Java introduces Unicode escape sequences. \uxxxx where xxxx is a four hexadecimal digit Unicode number. For a Space use '\u0020'.
Ryan
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: character to insert space
Similar Threads
can't update database?
Display character for HTML Number
cutting string into peaces
Word wrapping long text without whitespaces
Call a servlet on the url pattern /_/
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter