[fpc-pascal] Record helpers on built in types?
Anthony Walter
sysrpl at gmail.com
Thu Feb 19 20:45:57 CET 2015
Okay, no problems Sven. Thanks again for doing what you've done. I feel
like the class helpers on built ins is so great already. By the way, after
adding in some I decided to write an FTP client implementation using
StringHelper to great effect. Here's how it worked out (and fully tested):
http://www.getlazarus.org/helpers/ftpclient/
When you remove the comments it's probably around only 500 lines and was
easy to implement thanks to helper methods like Contains, Between, Split,
Pop, Words.
Example from PASV command:
'227 Entering Passive Mode (157,28,148,37,129,44)'
Becomes (at line 430):
Values := S.Between('(', ')').SplitInt(','); // Values now is array of 6
integers
Example from LIST command:
'lrwxrwxrwx 1 0 0 3 Jul 02 2013 public -> pub'
Becomes (at line 637):
Columns := S.Words(9); // Columns is now an array of 9 trimmed strings
It's so easy now!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20150219/5298e10f/attachment.html>
More information about the fpc-pascal
mailing list