开发者

implement the URL match in C++

开发者 https://www.devze.com 2022-12-26 13:34 出处:网络
Given a list of URLs, such as开发者_如何学Python a/b/e/f, b/c/d/k/g, s/e/c/d, how to match an input URL to the one in the list, for example, an input c/d should be matched to s/e/c/d, not b/c/d/k/g Wh

Given a list of URLs, such as开发者_如何学Python a/b/e/f, b/c/d/k/g, s/e/c/d, how to match an input URL to the one in the list, for example, an input c/d should be matched to s/e/c/d, not b/c/d/k/g


Why not b/c/d/k/g? Are the "Url"s simply strings? If so simply search it using strstr or one of its derivative (wcsstr, _mbsstr, _mbsstr_l).


Just check if input is equal to input.size() trailing characters in the possible url match.

0

精彩评论

暂无评论...
验证码 换一张
取 消