Skip to content
Discussion options

You must be logged in to vote

This can be done using the string method substr(int i, int j).

string str = "porcupine tree";
string new_str;

new_str = str.substr(10, str.len()-1);
$display("new_str = %s", new_str);

Output:

new_str = tree

Check out this link for more about SystemVerilog string methods and examples:
https://www.systemverilog.io/verification/systemverilog-string-methods/

Replies: 1 comment

Comment options

subbdue
Mar 18, 2023
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by subbdue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant