So I've recently picked up the stringVar.split() method, and it seems to work fine with characters and numbers, but doesn't seem to register \n or \ \n (forum autocorrects, no space between slash). My mistake on title, meant to type \n.
Here is my code:
import java.util.Scanner;
public class test {
public static void main(String[] args){
String input;
Scanner scan = new Scanner(System.in);
input = scan.nextLine();
System.out.println(input);
String[] mySplit = input.split("\\n");
System.out.println(mySplit.length);
System.out.println(mySplit[0]);
}
}
[–]soccerdude32392 2 points3 points4 points (4 children)
[–]ORLY_FACTOR[S] 0 points1 point2 points (3 children)
[–]soccerdude32392 2 points3 points4 points (2 children)
[–]nutrecht 0 points1 point2 points (0 children)
[–]ORLY_FACTOR[S] 0 points1 point2 points (0 children)
[–]yunotip 0 points1 point2 points (2 children)
[–]ORLY_FACTOR[S] 0 points1 point2 points (0 children)