Hi , i want to print this string
module tb;
string str=""OFF""; // Note : string should be printed as ""OFF"" not "OFF" .
initial begin
$display("str = %s",str);
end
endmodule
also if str=‘10ns’ , how can i print this as as ‘10ns’ , please help
In reply to Alok_Mandal:
You need to put a backslash \ character before the double-quote ". There is no need to do this for a single-quote.
string str="\"OFF\"";
string str="'10ns'";
See section 5.9.1 Special characters in strings in the IEEE 1800-2017 LRM.
In reply to Alok_Mandal:
You need to use backslash before double quotes two times to print ““OFF””.
module tb;
string str=“""OFF""”;
initial begin
$display(“str = %s”,str);
end
endmodule
In reply to dave_59:
Hi Dave,
string str =“"OFF"”;
result: str=“OFF”
Akhil mangu has catch my point, what i wanted to prinit.