char temp[256]; // store spec name minus 5 chars 'spec_'
sprintf (buf, "%s", spec_name (pMobIndex->spec_fun));
int i,j;
for (i=5,j=0; buf[i]!= '\0'; i++)
{
temp[j] = buf[i];
j++;
}
temp[j]='\0'; // terminate string
sprintf( buf, "[%5d-%3d] %-10.9s (%-8.7s)",
pMobIndex->vnum, pMobIndex ? pMobIndex->level:0, smash_color( pMobIndex->short_descr), temp);
sprintf( buf, "[%5d-%3d] %-10.9s (%-8.7s)",
pMobIndex->vnum, pMobIndex ? pMobIndex->level:0,
smash_color( pMobIndex->short_descr),
spec_name (pMobIndex->spec_fun) + 5);
I'm working on an OLC update and wanted to strip out 'spec_' from a listing so it's simply 'fido' instead of 'spec_fido'.
Of course I can do a for loop with i = 5, j=0 and just copy starting at the 5th char in the string, but… Isn't there a function to chop (like chomp in PHP) the FRONT part of a string off?
It's not something I use a lot, but I thought I'd used something like that in the past.
Ie (blah) sprintf (temp, "%s", skip_crap(oldstring, "spec_")) etc.
Although, I suppose I could simply make one that skips X characters. I just thought I'd seen something that'd allow me to show a string starting at like string[8] or such until '\0'.