Java: Como dividir uma string por um número de caractere
Tentei pesquisar online para resolver esta questão, mas não encontrei nad
Eu escrevi o seguinte código abstrato para explicar o que estou perguntando:
String text = "how are you?";
String[] textArray= text.splitByNumber(4); //this method is what I'm asking
textArray[0]; //it contains "how "
textArray[1]; //it contains "are "
textArray[2]; //it contains "you?"
O método splitByNumber divide a string "text" a cada 4 caracteres. Como posso criar esse método
Muito Obrigad