| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Snippets ini.c |
Re: Snippets ini.c
By: Kurt Kuzba to All on Fri Sep 19 2003 05:17 pm
> If you just want to run through the string once, then just
> run through the string once.
>
> /*_|_| notrail.c
> _|_|_| Public Domain : Kurt Kuzba : Friday, September 19, 2003
> _|_|_| Simple routine to strip trailing spaces in one pass.
> _|_|_| No guarantee or warrantee is given or implied.
> _|_|*/
> #include
> #include
> #define NUL 0;
> static char *notrail(char *string)
> {
> int space = 0, iterator = 0;
> if (string || *string)
> {
> for(iterator = space = 0; *(string + iterator); iterator++)
> if(!isspace(*(string + iterator))) space = iterator;
> }
> if(space != iterator) *(string + space + 1) = NUL;
> return string;
> }
This is an even bigger improvement. Thanks for the feedback.
digital man
Snapple "Real Fact" #65:
A one-day weather forecast requires about 10 billion math calculations.
--- SBBSecho 2.00-Win32
* Origin: Vertrauen - vert.synchro.net (1:103/705)SEEN-BY: 633/267 270 @PATH: 103/705 218/903 10/3 106/2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.