gpt4 book ai didi

system-verilog - 如何在系统 verilog 中的另一个字符串中搜索字符串?

转载 作者:行者123 更新时间:2023-12-02 01:02:06 25 4
gpt4 key购买 nike

如果我想知道字符串 a 是否包含在字符串 qwerty 中,在系统 Verilog 中是否有一种简单的方法可以做到这一点?喜欢下面的 C 代码吗?

a.strstr("qwerty");

最佳答案

目前我是这样做的,效果很好。但我想知道是否有更好的方法...

int len = a.len();
for( int i =0; i < len;i++) begin
if(a.substr(i,i+6-1) =="qwerty")
$display("found it");
end

关于system-verilog - 如何在系统 verilog 中的另一个字符串中搜索字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27288124/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com