How system verilog string ASCII to INTEGER work

In reply to dave_59:

I am seeing a similar issue. I am trying to convert string to ascii & from its ascii code,back to string. I keep getting 0 irrespective of the string I pass. Could you help ?

class stringascii; 
  string str ="wait"; 
  function try(); 
    int a; 
    string s; 
    a=str.atoi();
    $display("ascii formant of str %s is %d",str,a); 
    s.itoa(a); 
    $display("string format from asci is %s",s); 
  endfunction 
endclass 
module tb; 
  stringascii s1; 
  initial begin 
    s1=new();
    s1.try; 
  end 
endmodule