Convert string question

In reply to zz8318:

You never explained your situation, but I’m going to assume you are using the UVM and looking the the method of last resort.

You can use uvm_split_string to create an array of name-value pairs, and then call uvm_split_string again to split the name from the value.

string c2s, pairs[$], pair[$], names[$];
int values[$]
c2s = my_transactio.convert2string();
uvm_split_string(c2s," ",pairs);
names={};values={};
foreach(pairs[p]) begin
   uvm_split_string(pairs[p], "=", pair);
   names.push_back(pair[0]);
   values.push_back(pair[1].atoi());
end