Re: strip_char

From: George (greerga@circlemud.org)
Date: 12/18/98


On Fri, 18 Dec 1998, I Chose No Name wrote:

>Okay.. I need a function that removes all instances of a certain char from a
>string...
>example:
>---
>strip_char('~', text);
>---
>would remove all ~ from the string "text"
>
>however.. i dun know how to do that :) i messed around wit it for a while and
>i can't figure it out.. could someone give me some pointers on how to write a
>function like this? thanks a bunch

modify.c, of stock CircleMUD bpl14:

    char *tilde = str;
    while ((tilde = strchr(tilde, '~')))
      *tilde = ' ';

If you mean closing the space also, look at delete_doubledollar(), also in
the stock code.

--
George Greer
greerga@circlemud.org
http://www.circlemud.org/~greerga/


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST