Assign value to an enum from command line

Scenario:
I have an enum as follows, where the value of this enum should come from command line.

enum {red=0, yellow=3, blue} color_e;

To acheive that, an user is permitted provide plusargs at command line in both of the following ways.

Way 1: set by name

+COLOR=yellow

Way 2: set by number

+COLOR=3

Capture cmd line value for way 1 (as string)

$value$plusargs("COLOR=%s", str_color);
enum_wrapper::from_name(str_color, color_e)

Capture cmd line value for way 2: (as int)

$value$plusargs("COLOR=%0d", int_color);
$cast(color_e, int_color);

Query:
How do I write the code that would allow me to capture command line value whichever way (by name or number) it is provided?

Check out this utility package: svlib - a programmer's utility library for SystemVerilog

Thanks @dave_59 , the utility package seems to have many handly string manipulation methods. But adding an external pkg is not an option for now.
So, I wrote a simple helper function cmd_is_string(string cmd) that looks for if plusarg value started with a number or not; based on that decides whether plusargs suppose to be a string or a number.

    string v;
    int num;
    enum {BISTRO =-1, COFFEE_SHOP, BAR} p;
    ...
    if ($value$plusargs("ENUM=%s", v)) begin
      if ( cmd_is_string(v) ) begin
        enum_wrapper::from_name(v, p);
      end
      else begin
        if($value$plusargs("ENUM=%0d", num)) $cast (p, num);
      end

function cmd_is_string basically looks for if plusarg value started with number or not.