#String split
60 messages · Page 1 of 1 (latest)
Hey, @sick flume!
Please remember to /close this post once your question has been answered!
halp
Have you tried split() ?
Read up on it then
ok
so
did
System.out.println("Please enter Keys");
String keys = input.next();
System.out.println("Please enter Loader Link");
String loader = input.next();
List<String> list = new ArrayList<String>(Arrays.asList(keys.split("\n")));
have this
but
it splits after one use
I want it to add each item
right now I paste
V9W62Q36u0kgLpLdBvZ57cImNmX09z
BbBgtVaS800yH8KyTs4q1l9jCoGeM7
XxYbq7b4qIb5Ev45ZyTdZyTjJ562Q7
4bWlf5jX4BbdVr0cHh5o8mSyJ6CmKt
SuS7364N72iz0w5pJfE7774oS6DqZg
QhMpwW6CpOor0g48LsYd89ZsP0A2Vi
WeZ4bWbI8Nym7e7p5zM77s0jBqPuW3
F90znJ5DqO3vLpRjLi32AtGy67OaL8
BvYb341ZuKci6lLl44WsPsN9EfLxF1
8fZlnEsZ6FugTfEw9n80F1GzFdIqRy
9gYdhCoR087z6e0rKwZcBdZbFxJ87k
Gm9prVrUhOj6OwL7Eu4pStO050Rh9x
Aq3g13bAqPpePy2aV4GsCyV02mJiQq
501uhA0WjVg49qZmC17zI5VeObRcRt
EuYhl576xYl5F3P049M6JdQ2L1LmSm
as a test
and it skips "loader"
and idk why
it takes second row as string for it
The call of next() supposes that you're using a Scanner. A Scanner already splits
I am using a scanner
it splits wrong for what I want
I want to paste a list like above
and then grab it all as a string and break it into a list
thats where I am lost
But you're asking for keys then for a loader
Obviously the loader will be following the keys
It should be obvious that your idea doesn't work
I have no other idea
on how
is my issue
just learning gfx so trying to make a crude method
On how what? Computers are not magical. If you want to ask for keys first and for a loader then, you need to design a thing that tells them apart
ye thats what I am confused on
tryin to
first idea and simplest was get "string" then split
dumb the computer does that
If it's in some file you could read up on how to read JSON files
That way you'd put your keys in an array and the rest elsewhere
I havent really learned how to read json so I might have to read up on it
Use nextLine() instead of next().
Then split()
I tried
But it only reads one line to key then next line to loader
right. Then split() the line using the delimiter of your choice
I’ll give a shit in an hour when home
I have a feeling they didn't read the issue
./run ```java
String line = """
V9W62Q36u0kgLpLdBvZ57cImNmX09z
BbBgtVaS800yH8KyTs4q1l9jCoGeM7
XxYbq7b4qIb5Ev45ZyTdZyTjJ562Q7
4bWlf5jX4BbdVr0cHh5o8mSyJ6CmKt
SuS7364N72iz0w5pJfE7774oS6DqZg
QhMpwW6CpOor0g48LsYd89ZsP0A2Vi
WeZ4bWbI8Nym7e7p5zM77s0jBqPuW3
F90znJ5DqO3vLpRjLi32AtGy67OaL8
BvYb341ZuKci6lLl44WsPsN9EfLxF1
8fZlnEsZ6FugTfEw9n80F1GzFdIqRy
9gYdhCoR087z6e0rKwZcBdZbFxJ87k
Gm9prVrUhOj6OwL7Eu4pStO050Rh9x
Aq3g13bAqPpePy2aV4GsCyV02mJiQq
501uhA0WjVg49qZmC17zI5VeObRcRt
EuYhl576xYl5F3P049M6JdQ2L1LmSm
""";
String[] parts = line.split("\n");
System.out.println(parts.length);
System.out.println(parts[3]);
Here is your java(15.0.2) output @sharp trail
15
4bWlf5jX4BbdVr0cHh5o8mSyJ6CmKt
./run ```java
String line = "xxx yyy";
String[] index = line.split(" ");
System.out.println(index.length);
System.out.println(index[0]);
System.out.println(index[1]);
Here is your java(15.0.2) output @sharp trail
2
xxx
yyy
I just can't use a scanner in "I Run Code" bot, as far as I know, so I'm hardcoding it. But you could use scanner.nextLine() just as easily.
Ill give it a shot
@sick flume if you are done with the channel pls close it