User guide

24-6
SystemVerilog Testbench Constructs
string string1 = "abc";
string string2 = "xyz";
initial
begin
$display ("string1 is \"%s\"",string1);
string1.putc(0,42);
$display ("string1 is \"%s\"",string1);
string1.putc(1,string2);
$display ("string1 is \"%s\"",string1);
end
endmodule
The $display system tasks display the following:
string1 is "abc"
string1 is "*bc"
string1 is "*xc"
toupper()
Returns a string with the lower case characters converted to upper
case.
string string1 = "abc";
string string2 = string1.toupper;
initial
begin
$display("string1 is \"%s\"",string1);
$display("string2 is \"%s\"",string2);
end
The $display system tasks display the following:
string1 is "abc"
string2 is "ABC"