public static int extractIndex(String attributeName) {

        int index = 0;
        // check if the value index is appended to the attribute name
        if (hasIndex(attributeName)) {
            try {
                String temp = attributeName.substring(attributeName.lastIndexOf("[") + 1, attributeName.length() - 1);

                index = Integer.parseInt(temp);
            } catch (NumberFormatException e) {
                // ignore
            }
        }
        return index;
    }
public static int extractIndex ( String attributeName ) { int index = 0 ; if ( hasIndex ( attributeName ) ) { try { String temp = attributeName . substring ( attributeName . lastIndexOf ( "[" ) + 1 , attributeName . length ( ) - 1 ) ; index = Integer . parseInt ( temp ) ; } catch ( NumberFormatException e ) { } } return index ; }
Extracts the attribute index from the given attribute name where the index is appended to the name like 'attributename[1]'.<p>

@param attributeName the attribute name

@return the extracted index