如何在c ++中创建类似string :: find的函数? [英] How to make function like string::find in c++?
本文介绍了如何在c ++中创建类似string :: find的函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在字符串中查找子字符串的代码是什么?
What code will look for searching substring in string?
推荐答案
有很多方法可以在另一个字符串中找到第一个出现的字符串,而Wiki提供了最常用算法的列表: http://en.wikipedia.org/wiki/String_searching_algorithm [ ^ ] - 以及它们如何工作的解释。
从那以后,您应该可以完成作业而无需其他帮助...
There are a large number of ways to find the first occurrence of one string within another, and Wiki provides a list of the most common algorithms: http://en.wikipedia.org/wiki/String_searching_algorithm[^] - together with explanations of how they work.
From that, you should be able to complete your homework with no further help...
这篇关于如何在c ++中创建类似string :: find的函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文