[Gambas-user] Help with some parsing
richard terry
rterry at ...1946...
Tue Feb 17 22:09:26 CET 2009
On Tue, 17 Feb 2009 05:55:10 pm you wrote:
> >>So my quesitoni is 'how to discover what the character is ?chr$(10)(13)
> >>and how to eliminate those before parsing.
>
> CHR$(10) & CHR$(13) - carriage return & line feed
> Those are special "command" character from the "stone age" of the
> informatic used to go to the next line (add new line) - was needed in the
> times where a martix printer with ink ribbon the single output device of
> the computer was....
>
>
> Try using REPLACE$, I never used it in GAMBAS, but the same operator in VB6
> was able to remove every char (also those with special functions)
>
> ResultString=REPLACE$(InputStringWithBadChars, CHR$(10), "")
> ResultString=REPLACE$(ResultString, CHR$(13), "")
>
>
> This will search (in 2 Stages) first for CHR$(10) and than for CHR$(13) and
> replace them with empty strings...
>
>
> hope this helps
That's the sort of solution I was looking for and I will try it and see if it
works better than my crude solution:
In the meantime I found another solution. I re-exported from msAccess, but
added a 'dummy field at the end I called 'end', so a theoretically complete
line of data would look like
surname|firstname|birthdate|socialhistory|end
I then read the lines concatenating them until I had a complete line:
Line Input #hfile, sLineInput
sIncompleteLine = sLineInput 'keep copy
Do Until Right(sIncompleteLine, 4) = "|end"
Line Input #hfile, sLineInput 'No, then get the next line
sIncompleteLine &= sLineInput 'and concatenate for
Loop
sLineInput = sIncompleteLine 'ok n now, keep going.
'Line is complete, so plit up into bits
bits = Split(sLineInput, "|")
thanks all, and benoit, I'll look at the gambas data thing but I've never been
able to get it to work - it won't read my postgres database without crashing,
I've posted that before.
Regards
richard
>
>
> kind regards
>
>
> Emil
More information about the User
mailing list