A single ASCII character requires 8-bits (1 byte) and to store a string we would need as many bytes as there are number of characters in the string. If the string is larger than the size of the reg variable, it will be truncated to the left and the left-most characters will be lost. This is a string literal which behaves like packed arrays of a width that is a multiple of 8-bits - the most common way in Verilog to store ASCII characters.
reg[16*8:0] my_string;// Can store 16 characters
my_string ="How are you";// 5 zeros are padded from MSB, and 11 char are stored
my_string ="How are you doing?"// 19 characters; my_string will get " are you doing?"
The string data-type is an ordered collection of characters. The length of a string variable is the number of characters in the collection, can have dynamic length and may vary during simulation. A string variable does not represent a string in the same way as a string literal. No truncation occurs when using the string variable.
string variable_name [= initial_value];
Here variable_name is a valid identifier and the optional initial_value can be a string literal, the value "" for an empty string, or a string data type expression. If an initial value is not specified at the time of declaration, then the variable defaults to "", an empty string literal.