Split string on the last occurrence of some character July 28, 2023 by Tarik You can try this int i = s.lastIndexOf(c); String[] a = {s.substring(0, i), s.substring(i)};