public static String[] splitString( String string, String separator ) {
    /*
     * 0123456 Example a;b;c;d --> new String[] { a, b, c, d }
     */
    // System.out.println("splitString ["+path+"] using ["+separator+"]");
    List<String> list = new ArrayList<>();

    if ( string == null || string.length() == 0 ) {
      return new String[] {};
    }

    int sepLen = separator.length();
    int from = 0;
    int end = string.length() - sepLen + 1;

    for ( int i = from; i < end; i += sepLen ) {
      if ( string.substring( i, i + sepLen ).equalsIgnoreCase( separator ) ) {
        // OK, we found a separator, the string to add to the list
        // is [from, i[
        list.add( nullToEmpty( string.substring( from, i ) ) );
        from = i + sepLen;
      }
    }

    // Wait, if the string didn't end with a separator, we still have information at the end of the string...
    // In our example that would be "d"...
    if ( from + sepLen <= string.length() ) {
      list.add( nullToEmpty( string.substring( from, string.length() ) ) );
    }

    return list.toArray( new String[list.size()] );
  }
@Test
  public void testSplitStringWithDifferentDelimiterAndEnclosure() {
    // Try a different delimiter and enclosure
    String[] result = Const.splitString( "a;'b;c;d';'e,f';'g';h", ";", "'" );
    assertNotNull( result );
    assertEquals( 5, result.length );
    assertEquals( "a", result[0] );
    assertEquals( "'b;c;d'", result[1] );
    assertEquals( "'e,f'", result[2] );
    assertEquals( "'g'", result[3] );
    assertEquals( "h", result[4] );

    // Check for null and empty as the last split
    result = Const.splitString( "a;b;c;", ";", null );
    assertNotNull( result );
    assertEquals( 3, result.length );

    result = Const.splitString( "a;b;c;''", ";", "'" );
    assertNotNull( result );
    assertEquals( 4, result.length );
  }