Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java ASCII Characters Inputting As A String

Tags:

java

ascii

I am interested in the following ASCII characters 11 Vertical Tab, 28 File Separtor and 13 Carriage Return. Through Java, the Character.isWhitespace() will tell me whether these characters are one of these types.

What I want to do is send input data as a String. For example character 13 is '\r' so this can be inputted into a String:

String input = new String("'\'rThis is");

From this I can identify that character 0, 1 and 2 from input.toCharArray() is ASCII character 13. How can the Vertical Tab and File Separtor be represented in a String.

I have done a lot of research but Google does not give the answer. The Horizantal tab is the tab character such as " This is" but what is the Veritical tab?

like image 735
user3189663 Avatar asked Jun 07 '26 17:06

user3189663


2 Answers

In principle, you can input them as Unicode codepoints, like so :

  • vertical tab : \u000b
  • file separator : \001c

I don't have my Java compiler at hand right now so I can't test if it actually works.

like image 182
Zoyd Avatar answered Jun 10 '26 07:06

Zoyd


You can always get the char value for any ASCII character in java by doing (char) [asciiValue] in this case (char) 11 to get vertical tab.

File Separator is available using File.seperator, I believe.

like image 45
DonyorM Avatar answered Jun 10 '26 05:06

DonyorM



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!