Jak podzielić ciąg w Javie
String string = "004-034556";
String[] parts = string.split("-");
String part1 = parts[0]; // 004
String part2 = parts[1]; // 034556
Mobile Star
String string = "004-034556";
String[] parts = string.split("-");
String part1 = parts[0]; // 004
String part2 = parts[1]; // 034556
String[] strings = "Thequickbrownfoxjumps".split("(?<=\\G.{4})"); // split all 4 chars
String[] strings = "Thequickbrownfoxjumps".split("(?<=\\G.{100})"); // this would be all 100 chars
// -> ['Theq', 'uick', 'brow', 'nfox', 'jump', 's']
String yourString = "Hello/Test/World";
String[] strings = yourString.split("/" /*<- Regex */);
Output:
strings = [Hello, Test, World]