progrm在字符串中查找子字符串 [英] progrm to find a substring in a string
问题描述
大家好,有人能告诉我在字符串中查找字符串
的最有效方法。
Ajay< aj *********** @ gmail.com>写道:大家好,有人能告诉我在字符串中查找字符串
的最有效方法。
By eye。
Ajay写道:大家好,有人能告诉我在字符串中查找字符串的最有效方法吗。
这取决于你对substring的意思。如果你想找到
第一次出现在另一个字符串中的特定字符串,请检查
标准函数strstr。
如果你正在寻找子串的替代品函数发现
在某些其他语言中返回一个新字符串,提供给定的
字符串,偏移量和长度,然后查看我在2006年3月18日发布的帖子/>
thread" Sub strings" ;.
Robert Gamble
Ajay写道:< blockquote class =post_quotes>大家好,有人能告诉我在字符串中查找字符串的最有效方法吗。
你需要定义你的问题更好。我猜测''substr''是
a子串...
我不知道它有多高效,但是便携式方法是使用
标准的strstr()函数。在一个好的标准库中查找
参考。
Hi all,Could anybody tell me the most efficient method to find a substr
in a string.
Ajay <aj***********@gmail.com> wrote:Hi all,Could anybody tell me the most efficient method to find a substr
in a string.
By eye.
Ajay wrote:Hi all,Could anybody tell me the most efficient method to find a substr
in a string.
That depends on what you mean by substring. If you are looking to find
the first occurence of a particular string within another string, check
out the standard function strstr.
If you are looking for a replacement for the "substring" function found
in certain other languages that returns a new string provided a given
string, offset, and length then see my post from 3/18/2006 in the
thread "Sub strings".
Robert Gamble
Ajay wrote:Hi all,Could anybody tell me the most efficient method to find a substr
in a string.
You need to define your question better. I''m guessing that ''substr'' is
a sub-string...
I don''t know how efficient it is, but a portable way is to use the
standard strstr() function. Look it up in a good standard library
reference.
这篇关于progrm在字符串中查找子字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!