Page 1 of 1

String function

PostPosted: Sat Apr 08, 2006 6:03 am
by DilloDude
Does anyone know how to convert the first n characters of a string to spaces, but leave the rest intact? So if n = 6, and I use the string "This is a string", it will convert it to " s a string". I would also like it to keep \n, if that were possible.

PostPosted: Sun Apr 09, 2006 2:39 pm
by makslane
The current version don't allow set the actor text letters like a array, so you need some workaround:

Code: Select all
char tmp[32]; //create a tmp string
strcpy(tmp, text); //copy the actor text to tmp
tmp[0] = ' '; //set the space in the tmp string
strcpy(text, tmp); //copy back to text actor