@Test public void testStringToArrayMultipleAttributesWithOptions() { String[] attributes = ReturningAttributesWidget.stringToArray( "cn, sn;lang-de;lang-en uid" ); assertNotNull( attributes ); assertArrayEquals( new String[] { "cn", "sn;lang-de;lang-en", "uid" }, attributes ); }
public static String[] stringToArray( String s ) { if ( s == null ) { return null; } else { List<String> attributeList = new ArrayList<String>(); StringBuffer temp = new StringBuffer(); for ( int i = 0; i < s.length(); i++ ) { char c = s.charAt( i ); if ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) || ( c >= '0' && c <= '9' ) || c == '-' || c == '.' || c == ';' || c == '_' || c == '*' || c == '+' || c == '@' || c == '=' ) { temp.append( c ); } else { if ( temp.length() > 0 ) { attributeList.add( temp.toString() ); temp = new StringBuffer(); } } } if ( temp.length() > 0 ) { attributeList.add( temp.toString() ); } return ( String[] ) attributeList.toArray( new String[attributeList.size()] ); } }
ReturningAttributesWidget extends AbstractWidget { public static String[] stringToArray( String s ) { if ( s == null ) { return null; } else { List<String> attributeList = new ArrayList<String>(); StringBuffer temp = new StringBuffer(); for ( int i = 0; i < s.length(); i++ ) { char c = s.charAt( i ); if ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) || ( c >= '0' && c <= '9' ) || c == '-' || c == '.' || c == ';' || c == '_' || c == '*' || c == '+' || c == '@' || c == '=' ) { temp.append( c ); } else { if ( temp.length() > 0 ) { attributeList.add( temp.toString() ); temp = new StringBuffer(); } } } if ( temp.length() > 0 ) { attributeList.add( temp.toString() ); } return ( String[] ) attributeList.toArray( new String[attributeList.size()] ); } } }
ReturningAttributesWidget extends AbstractWidget { public static String[] stringToArray( String s ) { if ( s == null ) { return null; } else { List<String> attributeList = new ArrayList<String>(); StringBuffer temp = new StringBuffer(); for ( int i = 0; i < s.length(); i++ ) { char c = s.charAt( i ); if ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) || ( c >= '0' && c <= '9' ) || c == '-' || c == '.' || c == ';' || c == '_' || c == '*' || c == '+' || c == '@' || c == '=' ) { temp.append( c ); } else { if ( temp.length() > 0 ) { attributeList.add( temp.toString() ); temp = new StringBuffer(); } } } if ( temp.length() > 0 ) { attributeList.add( temp.toString() ); } return ( String[] ) attributeList.toArray( new String[attributeList.size()] ); } } ReturningAttributesWidget( IBrowserConnection browserConnection, String[] initialReturningAttributes );  ReturningAttributesWidget(); }
ReturningAttributesWidget extends AbstractWidget { public static String[] stringToArray( String s ) { if ( s == null ) { return null; } else { List<String> attributeList = new ArrayList<String>(); StringBuffer temp = new StringBuffer(); for ( int i = 0; i < s.length(); i++ ) { char c = s.charAt( i ); if ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) || ( c >= '0' && c <= '9' ) || c == '-' || c == '.' || c == ';' || c == '_' || c == '*' || c == '+' || c == '@' || c == '=' ) { temp.append( c ); } else { if ( temp.length() > 0 ) { attributeList.add( temp.toString() ); temp = new StringBuffer(); } } } if ( temp.length() > 0 ) { attributeList.add( temp.toString() ); } return ( String[] ) attributeList.toArray( new String[attributeList.size()] ); } } ReturningAttributesWidget( IBrowserConnection browserConnection, String[] initialReturningAttributes );  ReturningAttributesWidget(); void createWidget( Composite parent ); void setBrowserConnection( IBrowserConnection browserConnection ); void setInitialReturningAttributes( String[] initialReturningAttributes ); void setEnabled( boolean b ); String[] getReturningAttributes(); void saveDialogSettings(); void setFocus(); static String[] stringToArray( String s ); }
ReturningAttributesWidget extends AbstractWidget { public static String[] stringToArray( String s ) { if ( s == null ) { return null; } else { List<String> attributeList = new ArrayList<String>(); StringBuffer temp = new StringBuffer(); for ( int i = 0; i < s.length(); i++ ) { char c = s.charAt( i ); if ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) || ( c >= '0' && c <= '9' ) || c == '-' || c == '.' || c == ';' || c == '_' || c == '*' || c == '+' || c == '@' || c == '=' ) { temp.append( c ); } else { if ( temp.length() > 0 ) { attributeList.add( temp.toString() ); temp = new StringBuffer(); } } } if ( temp.length() > 0 ) { attributeList.add( temp.toString() ); } return ( String[] ) attributeList.toArray( new String[attributeList.size()] ); } } ReturningAttributesWidget( IBrowserConnection browserConnection, String[] initialReturningAttributes );  ReturningAttributesWidget(); void createWidget( Composite parent ); void setBrowserConnection( IBrowserConnection browserConnection ); void setInitialReturningAttributes( String[] initialReturningAttributes ); void setEnabled( boolean b ); String[] getReturningAttributes(); void saveDialogSettings(); void setFocus(); static String[] stringToArray( String s );  }