Night_Wolf17

printTextPerRoles#2

Mar 17th, 2021 (edited)
544
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1.         StringBuilder sb = new StringBuilder();
  2.         for (String role : roles) {
  3.             sb.append(role).append(":\n");
  4.             for (int i = 0; i < textLines.length; i++) {
  5.                 if (textLines[i].startsWith(role + ":")) {
  6.                     sb.append((i + 1)).append(")").append(textLines[i].substring(role.length() + 1)).append("\n");
  7.                 }
  8.             }
  9.             sb.append("\n");
  10.         }
  11.         return sb.toString();
Add Comment
Please, Sign In to add comment