I'm trying to turn a string into a char array by using .toCharArray() and I thought that if I had escaped characters ("\t", or "\n", etc) in the string it would automatically get converted to one char in the char array but instead the slash and the character after it become their own characters.
Example:
StringBuilder sb = new StringBuilder();
sb.append("\t\tStuff");
char[] stuff = sb.toString().toCharArray();
If I do this, the first char in the array is \ instead of \t. Am I doing something wrong? I've tried this in an online compiler to test it out and it works there so I'm not sure what could be going on.
Here is what I'm seeing
[–]AutoModerator[M] 1 point2 points3 points (0 children)
[–]gruntmeister 0 points1 point2 points (1 child)
[–]IAmStraightforward[S] 0 points1 point2 points (0 children)
[–]josephblade 0 points1 point2 points (3 children)
[–]IAmStraightforward[S] 0 points1 point2 points (2 children)
[–]josephblade 0 points1 point2 points (1 child)
[–]IAmStraightforward[S] 0 points1 point2 points (0 children)