﻿<?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>Gavin&#039;s Blog &#187; Trim</title>
	<atom:link href="http://laigw.name/tag/trim/feed" rel="self" type="application/rss+xml" />
	<link>http://laigw.name</link>
	<description>Keep it simple, stupid. Simplicity is beauty.</description>
	<lastBuildDate>Sun, 29 Jan 2012 07:14:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Delphi Trim函数C语言实现</title>
		<link>http://laigw.name/post/3.html</link>
		<comments>http://laigw.name/post/3.html#comments</comments>
		<pubDate>Fri, 14 Nov 2008 11:47:15 +0000</pubDate>
		<dc:creator>Gavin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Trim]]></category>

		<guid isPermaLink="false">http://www.laigw.name/?p=3</guid>
		<description><![CDATA[用了一段时间Delphi，感觉里面的Trim函数很好用，却发现在C下没有这个函数，而自己又经常想在C下使用它，就仿Delphi里面的代码写了一个，以解燃眉之急：P


&#160;查看代码 C1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/************************************************
#函数功能： 去掉src字符串的前缀和后缀空格，存放于dst指向内存，并且返回该指针
#形式参数： dst: 用于保存结果返回的字符指针；
src: 要去掉前后缀空格的源字符串指针；
#返回值  ： char*指针，指向函数处理后的结果字符串
#说    明： 使用该函数要加入：#include
*************************************************/
char* Trim&#40;char* dst, const char* src&#41;
&#123;
int l, r, i;
&#160;
r = strlen&#40;src&#41;;
for&#40;l = 0; l &#60; r &#38;&#38; src&#91;l&#93; &#60;= ' '; ++l&#41;;
if&#40;l &#62;= r&#41; dst&#91;0&#93; = '\0';
else&#123;
for&#40;; src&#91;r-1&#93; &#60;= ' '; --r&#41;;
for&#40;i = l; i &#60; r; dst&#91;i-l&#93; = src&#91;i&#93;, ++i&#41;;
dst&#91;i-l&#93; = [...]]]></description>
		<wfw:commentRss>http://laigw.name/post/3.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

