String function

Non-platform specific questions.

String function

Postby DilloDude » Sat Apr 08, 2006 6:03 am

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.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby makslane » Sun Apr 09, 2006 2:39 pm

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
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest