public static Stack<String> splitParts(String name){
  while (name.startsWith("."))   name=name.substring(1);
  Stack<String> parts=new Stack<>();
  int last=0;
  int pos=0;
  String part;
  while (true) {
    pos=last;
    while (true) {
      pos=name.indexOf('.',pos);
      if (pos < 0)       break;
      if (name.charAt(pos - 1) == '\\')       ++pos;
 else       break;
    }
    if (pos < 0)     break;
    part=name.substring(last,pos);
    if (!part.endsWith("]"))     part+="[0]";
    parts.add(part);
    last=pos + 1;
  }
  part=name.substring(last);
  if (!part.endsWith("]"))   part+="[0]";
  parts.add(part);
  return parts;
}

public static Stack < String > splitParts ( String name ) { while ( name . startsWith ( "." ) ) name = name . substring ( 1 ) ; Stack < String > parts = new Stack < > ( ) ; int last = 0 ; int pos = 0 ; String part ; while ( true ) { pos = last ; while ( true ) { pos = name . indexOf ( '.' , pos ) ; if ( pos < 0 ) break ; if ( name . charAt ( pos - 1 ) == '\\' ) ++ pos ; else break ; } if ( pos < 0 ) break ; part = name . substring ( last , pos ) ; if ( ! part . endsWith ( "]" ) ) part += "[0]" ; parts . add ( part ) ; last = pos + 1 ; } part = name . substring ( last ) ; if ( ! part . endsWith ( "]" ) ) part += "[0]" ; parts . add ( part ) ; return parts ; }
splits a som name in the individual parts .
