Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
string editing Posted by sviesusis_alus on 25 Feb 2010 at 10:06 AM
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 ?
Report
Re: string editing Posted by ShadoWsaZ on 26 Feb 2010 at 10:02 AM
Hello,

Aren't you satisfied with s := Copy(s, 1, Length(s)-4) ?
Report
Re: string editing Posted by _Atex_ on 28 Feb 2010 at 10:59 PM
: 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:
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.




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.