Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Deleting a piece of a string...  (Read 1377 times)

0 Members and 1 Guest are viewing this topic.
Deleting a piece of a string...
« on: November 29, 2006, 02:23:29 am »
  • =/
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2284
I have a bit of a problem, in my draw event I have this:
Code: [Select]
cur_string = cur_string+keyboard_string
draw_text(0,0,""+string(cur_string))

if keyboard_string > ""{
 keyboard_string = ""
}
Basicly all it does is add the string the dude has typed and prints it.

 Anyway, how would I go about deleting a piece from the string? Like, if I pressed backspace, the last letter I typed would be deleted from the current string.

[Ps]
I know of the other way to print a string that someone types but it does not work for what I'm trying to do.
Logged
Re: Deleting a piece of a string...
« Reply #1 on: November 29, 2006, 02:32:16 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
cur_string = string_delete(cur_string,string_length(cur_string)-1,1);
Logged

Jed

Re: Deleting a piece of a string...
« Reply #2 on: November 29, 2006, 03:04:57 am »
You also look like you need a space on that keyboard if then fork :P
Logged
Re: Deleting a piece of a string...
« Reply #3 on: November 29, 2006, 03:05:36 am »
  • =/
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2284
cur_string = string_delete(cur_string,string_length(cur_string)-1,1);
Thank you WWFan.
Logged
Re: Deleting a piece of a string...
« Reply #4 on: November 30, 2006, 12:21:13 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1635
Code: [Select]
cur_string = cur_string+keyboard_string
draw_text(0,0,""+string(cur_string))

This seems odd. Why not

Code: [Select]
cur_string += keyboard_string;
draw_text(0,0,cur_string);
Logged
Re: Deleting a piece of a string...
« Reply #5 on: November 30, 2006, 02:15:37 am »
  • =/
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2284
Code: [Select]
cur_string = cur_string+keyboard_string
draw_text(0,0,""+string(cur_string))

This seems odd. Why not

Code: [Select]
cur_string += keyboard_string;
draw_text(0,0,cur_string);
I have certain coding habits from other programs that don't allow you to do that kind of thing. Meh, they do the same thing anyway.
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.133 seconds with 49 queries.

anything