fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. class Ideone
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. String str = "role1@role2@role3@role4$arole";
  9. String[] res = str.split("(?=[@$])");
  10. System.out.println(Arrays.toString(res));
  11. }
  12. }
Success #stdin #stdout #stderr 0.05s 711168KB
stdin
Standard input is empty
stdout
[role1, @role2, @role3, @role4, $arole]
stderr
Java HotSpot(TM) Client VM warning: No monotonic clock was available - timed services may be adversely affected if the time-of-day clock changes