public static Colour attemptToGetAsColour ( String part ) { String target = part . toUpperCase ( ) ; for ( int i = 0 ; i < Colour . values ( ) . length ; i ++ ) { String col = Colour . values ( ) [ i ] . name ( ) . replace ( "_" , "" ) ; if ( col . equals ( target ) ) return Colour . values ( ) [ i ] ; } return null ; }
Attempt to parse string as a Colour