Author Topic: Help with string  (Read 1164 times)

0 Members and 1 Guest are viewing this topic.

Offline Gnintendo

  • Major
  • *
  • Posts: 61
Help with string
« on: November 02, 2008, 08:26:13 am »
If I have a string, and I want to remove JUST the first character, how would I go about doing that?

Offline Toumaz

  • Veteran
  • *****
  • Posts: 1904
Re: Help with string
« Reply #1 on: November 02, 2008, 10:57:22 am »
foo := 'Bar';
foo := Copy(foo, 2, Length(foo)-1);
WriteLn(foo); // Will print 'ar'

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Help with string
« Reply #2 on: November 02, 2008, 11:08:26 am »
seems like there was a delete() function, but i cant get it to work <.< Keeps swearing at me every time i try using it =/

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Help with string
« Reply #3 on: November 02, 2008, 11:17:03 am »
procedure delete(var s: string; ifrom, icount: Longint);

Offline Gnintendo

  • Major
  • *
  • Posts: 61
Re: Help with string
« Reply #4 on: November 02, 2008, 01:09:26 pm »
foo := 'Bar';
foo := Copy(foo, 2, Length(foo)-1);
WriteLn(foo); // Will print 'ar'
What are the parameters for the Copy function?
What's the 2 for?

Offline danmer

  • Camper
  • ***
  • Posts: 466
  • crabhead
Re: Help with string
« Reply #5 on: November 02, 2008, 01:52:16 pm »
What are the parameters for the Copy function?
What's the 2 for?
function copy(s: string; ifrom, icount: Longint): string
so 2 is where to start copying (first char is 1, not 0) and the last arg is how many chars to copy