Re: [fpc-pascal] splitting string into array

2007-07-10 Thread Luca Olivetti
En/na L ha escrit: Many functions should be merged into an FPC rtl unit I suppose, since it appears many of us are reinventing the wheel each time rolling our own private units. It's amazing the amount of extremely useful types/classes/functions available out of the box, but they are virtuall

Re: [fpc-pascal] splitting string into array

2007-07-10 Thread L
Marc Santhoff wrote: > Hi, > > is there any function in the libraries of fpc for splitting a string > into an array naming the separator? There is a function in the substrings.pas unit included in this package: http://z505.com/cgi-bin/powtils/docs/1.6/idx.cgi?file=substrsplit&unit=substrings And

Re: [fpc-pascal] USB Printers

2007-07-10 Thread Tom York
Sorry for all of these replies, I think my ISP (webhost) is working on their mail servers. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] splitting string into array

2007-07-10 Thread Marc Santhoff
Am Dienstag, den 10.07.2007, 14:56 +0200 schrieb Andrea Mauri: > I used this, check it. > > // Returns an array with the parts of "str" separated by "separator" > function Split(const str: string; const separator: string): array of string; > var > i, n: integer; > strline, strfield: string; >

Re: [fpc-pascal] splitting string into array

2007-07-10 Thread Martin Schreiber
On Tuesday 10 July 2007 13.00, Marc Santhoff wrote: > Hi, > > is there any function in the libraries of fpc for splitting a string > into an array naming the separator? > Procedure splitstring from MSEgui, file lib/common/kernel/msestrings.pas. http://www.homepage.bluewin.ch/msegui/ Martin _

Re: [fpc-pascal] USB Printers

2007-07-10 Thread Tom York
Disregard my prior post, it is Delphi specific. I did find this one. (http://www.freepascal.org/cgi-bin/viewcvs.cgi/trunk/components/printers/samples/rawmode/unitmain.pas?root=lazarus&rev=10129&view=markup) procedure WritePrinter; var sTemp: String; Written: Integer; begin Written := 0; sTe

Re: [fpc-pascal] USB Printers

2007-07-10 Thread Tom York
Disregard my prior post. It does not work unless the Windows Spooler API is converted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] USB Printers

2007-07-10 Thread Tom York
Disregard my prior post. It does not work unless the Windows Spooler API is converted. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] splitting string into array

2007-07-10 Thread Andrea Mauri
occurs is: function Occurs(const str, separator: string): integer; var i, nSep: integer; begin nSep:= 0; for i:= 1 to Length(str) do if str[i] = separator then Inc(nSep); Result:= nSep; end; Andrea Mauri ha scritto: I used this, check it. // Returns an array with the parts of "str" sepa

Re: [fpc-pascal] USB Printers

2007-07-10 Thread Tom York
Since you specify LPT1:, I assume you are using Windows. Obviously the solution for Linux would be different than Windows. I am not quite sure about FPC, but in Delphi you basically have two choices. 1) Capture the USB printer to an LPT port, then attempt assign(printer, 'LPTx:'); (not a go

Re: [fpc-pascal] splitting string into array

2007-07-10 Thread Andrea Mauri
I used this, check it. // Returns an array with the parts of "str" separated by "separator" function Split(const str: string; const separator: string): array of string; var i, n: integer; strline, strfield: string; begin n:= Occurs(str, separator); SetLength(Result, n + 1); i := 0; strline:

Re: [fpc-pascal] splitting string into array

2007-07-10 Thread Wolfram Kläger
Here is a Delphi implementation of the common PHP function 'explode'. http://www.michael-puff.de/Developer/Delphi/Code-Snippets/Explode.html Your example then becomes to .. A := Explode('-', 'ab-cd-ef'); writeln(A[1]); // expect 'cd' .. The inverse is accomplished by using PHP like 'implode', wh

[fpc-pascal] USB Printers

2007-07-10 Thread Roberto Gonçalves Barreiro
I'm a delphi programmer. I'm printing a report using: assign(wPrinter,'Lpt1:') and it goes ok in paralel priner. I did assign(wPrinter,'USB001') and it did not work. Do you know how to print in USB printers? I thanks a lot if you can help me. Roberto Barreiro Recife, Brazil Ro

Re: [fpc-pascal] splitting string into array

2007-07-10 Thread Marc Santhoff
Am Dienstag, den 10.07.2007, 13:17 +0200 schrieb Luca Olivetti: > En/na Marc Santhoff ha escrit: > > Hi, > > > > is there any function in the libraries of fpc for splitting a string > > into an array naming the separator? > > not exactly but I found: > > http://www.freepascal.org/docs-html/rtl/s

Re: [fpc-pascal] splitting string into array

2007-07-10 Thread Daniël Mantione
Op Tue, 10 Jul 2007, schreef Marc Santhoff: > Hi, > > is there any function in the libraries of fpc for splitting a string > into an array naming the separator? > > In awk for eample if you do this: > > split("ab-cd-ef", x, "-") > print x[2] > > it would split up the first string

Re: [fpc-pascal] splitting string into array

2007-07-10 Thread Luca Olivetti
En/na Marc Santhoff ha escrit: Hi, is there any function in the libraries of fpc for splitting a string into an array naming the separator? not exactly but I found: http://www.freepascal.org/docs-html/rtl/strutils/extractdelimited.html maybe exactly what you're searching is already there, s

[fpc-pascal] splitting string into array

2007-07-10 Thread Marc Santhoff
Hi, is there any function in the libraries of fpc for splitting a string into an array naming the separator? In awk for eample if you do this: split("ab-cd-ef", x, "-") print x[2] it would split up the first string using "-" as separator and print cd to the output. Tha

Re: [fpc-pascal] Linux Kernel and FPC

2007-07-10 Thread Michael Van Canneyt
On Tue, 10 Jul 2007, ik wrote: > On 7/9/07, Alain Michaud <[EMAIL PROTECTED]> wrote: > > Hi, > > > > last year I have written a very small driver using the "char" model, > > ie. that is put in src/linux/drivers/char something very simple to > > read/write a few bytes on an output port. I would

Re: [fpc-pascal] Linux Kernel and FPC

2007-07-10 Thread ik
On 7/9/07, Alain Michaud <[EMAIL PROTECTED]> wrote: Hi, last year I have written a very small driver using the "char" model, ie. that is put in src/linux/drivers/char something very simple to read/write a few bytes on an output port. I would have been glad to write it in pascal, but I do not t