docs: public static String getFirstPathComponent(String path) {
          int sIdx = path.indexOf('/');
  
          //path has no /'s ? return path.
          if (sIdx == -1) {
              return path;
          }
          //path has 1 char or less, (if 1, must be a '/' by previous if), return ""
          if (path.length() <= 1) {
              return "";
          }
          //path has more than 1 char, starts with /, has no other /'s, return path without leading /.
          if (sIdx == 0 && path.indexOf('/', 1) == -1) {
              return path.substring(1);
          }
  
          if (sIdx != 0) {
              //path does not start with /, but has / present.
              //return up to but not including 1st / position.
              return path.substring(0, sIdx);
          } else {
              //path starts with /, has multiple /'s present
              //remove 1st char and return up to but not including 1st / position.
              return path.substring(1, path.indexOf('/', 1));
          }
  
      }