In java I have to place Control + A character to separate fields . So how can I append or concat Control + A character in StringBuffer using java.
Asked
Active
Viewed 3,904 times
1 Answers
6
final char ctrlA = '\u0001';
happens to be unicode-16, char 1
edit: if you want a more 'automated' method you could use a StringBuilder as you are reading in the fields. someone already explained this here: https://stackoverflow.com/a/152677/4197697

rogerdpack
- 62,887
- 36
- 269
- 388

softwarenewbie7331
- 967
- 6
- 12
-
That's fine, is it not directly possible to append ctrl+A character at the time string creation without declaring character like this – agarwal_achhnera Dec 10 '14 at 02:14
-
'\u0001' is the Ctrl+A character, but declaring it like this makes your code readable – softwarenewbie7331 Dec 10 '14 at 02:15
-
yes that's fine, but is there a way to append at the time of string creation – agarwal_achhnera Dec 10 '14 at 02:18
-
yea. using StringBuilder, see the link i added to the answer – softwarenewbie7331 Dec 10 '14 at 02:40