I have a file and i have to read it line by line. The file contains similar lines, like these:
asd@lol kek|1.1.1.1
title@content m e s s a g e|2.3.4.5
I read these lines to String variables. How can i split these strings to other variables? For example: var1=title, var2=content, var3=m e s s a g e, var4=2.3.4.5
I tried something like this, but i cant find the solution:
stringArray=line.split("|");
splitmethod. Read its documentation and check its overloaded versions (especiallysplit(regex,limit)). You can also take a look atPatternandMatcherclasses.split("|")read Splitting a Java String by the pipe symbol using split(“|”)