string editing - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

string editing

sviesusis_alussviesusis_alus Posts: 1Member
hey. what is the fastest way to cut some symbols at the end of string ?
for example:
from this: /home/justas/psc/test.pas
to make /home/justas/psc/test

any suggestions ?

Comments

  • ShadoWsaZShadoWsaZ Posts: 27Member
    Hello,

    Aren't you satisfied with s := Copy(s, 1, Length(s)-4) ?
  • _Atex__Atex_ Posts: 163Member
    : hey. what is the fastest way to cut some symbols at the end of
    : string ?
    : for example:
    : from this: /home/justas/psc/test.pas
    : to make /home/justas/psc/test
    :
    : any suggestions ?
    :


    This is the fastest way:[code][color=Blue]var s:string;
    sl:byte absolute s; { <-- length of s }

    begin
    s:='/home/justas/psc/test.pas';
    writeln(s);
    dec(sl,4);
    writeln(s);
    readln;
    end.[/color][/code]
Sign In or Register to comment.