<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ubuntu,debian,redhat -linuxany.com &#187; strtok</title>
	<atom:link href="http://www.linuxany.com/archives/tag/strtok/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxany.com</link>
	<description></description>
	<lastBuildDate>Thu, 26 Jan 2012 08:59:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>c语言中的字符串分割(strstr)</title>
		<link>http://www.linuxany.com/archives/1237.html</link>
		<comments>http://www.linuxany.com/archives/1237.html#comments</comments>
		<pubDate>Wed, 07 Apr 2010 04:25:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[ctype]]></category>
		<category><![CDATA[needle]]></category>
		<category><![CDATA[strstr]]></category>
		<category><![CDATA[strtok]]></category>
		<category><![CDATA[token]]></category>

		<guid isPermaLink="false">http://www.linuxany.com/?p=1237</guid>
		<description><![CDATA[在前面C语言中利用strtok函数进行字符串分割介绍的strtok函数，比较适合多个字符（也就是字符串）作分隔符的场合，而很多时候我们仅仅需要某一个特定的字符来分割字符串，当然利用strtok也可以实现，不过这里介绍的strstr效率上来说更加适合。 原型：extern char *strstr(char *haystack, char *needle);所在头文件：#include &#60;string.h&#62;功能：从字符串haystack中寻找needle第一次出现的位置（不比较结束符NULL)。说明：返回指向第一次出现needle位置的指针，如果没找到则返回NULL。 int main(int argc,char **argv) { char&#160;temp[10]; char *haystack=&#34;aaa&#124;&#124;a&#124;&#124;bbb&#124;&#124;c&#124;&#124;ee&#124;&#124;&#34;; char *needle=&#34;&#124;&#124;&#34;; char* buf = strstr( haystack, needle); while(&#160;buf != NULL ) { strncpy(temp, haystack, buf-haystack); temp[buf-haystack] =0; printf(&#160;&#34;%s\n &#34;, temp); //haystack); &#160; haystack = buf + strlen(needle); &#160; buf = strstr(&#160;haystack, needle); } return&#160;0; } 您还可能感兴趣的内容查找指定字符串在另一字符串中的位置(strpos)]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/1237.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>查找指定字符串在另一字符串中的位置(strpos)</title>
		<link>http://www.linuxany.com/archives/908.html</link>
		<comments>http://www.linuxany.com/archives/908.html#comments</comments>
		<pubDate>Thu, 24 Dec 2009 04:32:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[strpos]]></category>
		<category><![CDATA[strstr]]></category>
		<category><![CDATA[strtok]]></category>

		<guid isPermaLink="false">http://www.linuxany.com/?p=908</guid>
		<description><![CDATA[#include &#34;stdio.h&#34; int main() { &#160; &#160;&#160; char* str = &#34;linuxany.com&#34;; &#160; &#160;&#160; printf(&#34;pos1:%d\n&#34;,strpos(str,&#34;any&#34;,1)); &#160; &#160;&#160; printf(&#34;pos2:%d\n&#34;,strpos(str,&#34;n&#34;,2)); &#160; &#160;&#160; return&#160;0; } //函数定义:取字符串位置,中文作为一个字符计算 int strpos(const char* string,const char* find,int number) { &#160; &#160;&#160; char* pos = string; &#160; &#160;&#160; char* p = string; &#160; &#160;&#160; int&#160;count = 0; &#160; &#160;&#160; while&#160;(number &#62; 0) &#160; &#160;&#160; { [...]]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/908.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

