last day (15 days later) » 

10:58 PM
5
A: Java: Splitting a String at two different points into 3 parts

alpha bravoyour could use this pattern ^(\S+)\s(.*?)\sat\s(.*)$ Demo ^ begining of string (\S+) caputre anything that is not a white space \s a white space (.*?) capture as few as possible \sat\s followed by a white space, the word "at" and a white space (.*)$ then capture...

 
for love of god, explain so we can learn?
did you use split function?
 
I used capturing groups
 
oh cool can you provide more info about it ? cuz when I use split function and put your regex inside it , it gives me the whole string. by the way, the other guy copied and pasted your answer
 
@KickButtowski, it is OK
@ifLoop, I like this format better
 
hi
your answer is awesome but do not know how to use it
in order to learn
 
10:59 PM
more info could be found here rexegg.com/regex-capture.html
 
k thank you
have you seen such a code
never seen the array list to be defiend like this
have u seen that?
public static void main(String[] args){
ArrayList<Integer>[][] list = new ArrayList[2][26];
list[0][0] = new ArrayList<Integer>();
list[0][0].add(5, 6);


for(ArrayList<Integer>[] arr : list){
System.out.println(Arrays.toString(list));
}

}
 
its an array of arraylists
the first line initializes the array
the second initializes one of the indexes with an ArrayList
 
this line
list[0][0].add(5, 6);
 
what arr you trying to learn? regex in general?
 
throws execption?
no this is from another post that make mer curious to ask
 
11:04 PM
what kind of exception?
 
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 5, Size: 0
did you find out what is wrong with the code?
 
yeah its pretty basic
index 5 doesnt exist yet in the list
 
could you explan ?
 
add 5 items to the list before you do list.add(5, 6);
thatll consume indexes 0-4
then youll be able to access index 5
but until index 5 is actually created, you cant access it
 
ya my bad I saw the add function now
there is no zero to four and the op wanted to add in index 5
did i get that right?
 
11:10 PM
yup
 
it seems i am too tried
 
its alright
 
thank you
 
any other questions?
 
lemme update my answer i will be back
 
11:11 PM
while im here
 
it is k i will take a look at your answers
see what is going on in your world
later
 
wait
 
i dont answer much anymore. i do mostly comments
just a heads up
most of my answers are from 2013 as i recall
but go ahead
 
good god
 
11:12 PM
look at my comments for more
 
why?
are you sitll there?
r u there?
2
Q: statement Arrays not working java

Supernaturalgirl 1967When I try to use Arrays to print out an Arrays to print out my 2D ArrayList it says "Arrays cannot be resolved" If this isn't how your suppose to print out an Arraylist then how are you suppose to? Here's my code: public static void main(String[] args){ ArrayList<Integer>[][] list =...

take a look at my answer if you can
and plz if someting is wrong change it I approve
 

last day (15 days later) »