Get index of enum from string?

Not sure if I understand you correctly but based on question title you may be looking for

YourEnum.valueOf("VALUE").ordinal(); 
//like Directions.valueOf("NORTH").ordinal();
  1. YourEnum.valueOf("VALUE") returns enum value with name "VALUE"
  2. each enum value knows its position (indexed from zero) which we can get by calling ordinal() method on it.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)