63319098

Date: 2020-08-08 19:52:41
Score: 4
Natty:
Report link

Why do you have to use a RegEx?

You can simply use indexOf and substring

  public List<String> splitOnDot(String input) {
    List<String> result = new ArrayList<>();
    int idx = -1;
    while ((idx = input.indexOf('.', idx + 1)) != -1) {
      result.add(input.substring(0, idx));
      input = input.substring(idx + 1);
    }
    return result;
  }
Reasons:
  • RegEx Blacklisted phrase (3): do you have
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Starts with a question (0.5): Why do you have to use a
  • Low reputation (0.5):
Posted by: jmizv