{
int i, len=strlen(ch->in_rom->name);
char name[MSL];
strcpy(name, ch->in_room->name); /* you could use strdup too */
for (i=0 i<len;i++){
  if (name[i]=' ') 
          name[i]='_';
  }
 sprintf(buf,"%s", name);
 send_to_char(buf, ch);
}



Or something;
>-----Original Message-----
>From: Mike [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, May 29, 2002 4:22 PM
>To: [email protected]
>Subject: Strip spaces
>
>
>Hi,
>    Alright. Say I have a string that i want to print in sprintf or
>something. Like:
>            sprintf(buf,"%s", ch->in_room->name);
>            send_to_char(buf, ch);
>    Something like that.  But many room names are things like: 
>The Big Red
>Hotel Lobby with Purple Carpets
>    Something screwy like that.  Is there a way that I could 
>get it to strip
>the spaces so that it is either:
>                TheBigRedHotelLobbywithPurpleCarpets
>                                        or
>                The_Big_Red_Hotel_Lobby_with_Purple_Carpets
>                                        ?
>If there is, it would be VERY useful. Thanks again,
>-tarian
>
>
>-- 
>ROM mailing list
>[email protected]
>http://www.rom.org/cgi-bin/mailman/listinfo/rom
>

Reply via email to