Link to home
Start Free TrialLog in
Avatar of MelissaCG
MelissaCG

asked on

Help manipulating strings

Hello, i have a table in PDF and I'd like to transfer it to EXCEL, but the softwares i use get it a little confusing... I copied the table to a string, and it separates the columns by SPACE... The problem is that the first column has a string that contains the caracter space and it splits into several columns...

I want an algorithm to check if the word in question is a number, if so it puts it a special caracter like * intead of space to separate those words, so i can use * intead in EXCEL... One more thing, there is an exception about the numbers... if the number is preceded by the words EMPRESA (in english COMPANY) or BANCO( in english BANK) it doesnt put the *... I'll attach the pdf here so you can have an idea of the table...
Relatorios-P2.zip
ASKER CERTIFIED SOLUTION
Avatar of cyberkiwi
cyberkiwi
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MelissaCG
MelissaCG

ASKER

When i compiled, i got several errors in this line :"    if (UpperCase(PrevWord) <> 'EMPRESA') and (UpperCase(PrevWord) <> 'BANCO')"

saying that "SOME_STRING" isnt a valid floating point...
Are you using the English version of Delphi?  You may have to change some quotes... otherwise, just remove the UpperCase or switch to CompareText (case-insensitive).

Have you changed any text at all? Names?

It compiles and was tested in Delphi (English)...
I havent changed the text... My delphi is Delphi 7 english version... I attached my project and the text i'm using from the table...
teste.zip
tabela1.txt
Hi,

I'm not kidding you, but.. it compiles, runs, then produces the attached.
Are you using any IDE tools? Compiler directives? mad Except?
This is strange.. I'm sure some expert can verify that your project builds just fine!
tabela2.txt
Hi Melissa,

I re-read your comment and have figured it out.  It's not a compile error, it's a runtime error - due to the "try - except" block.  It tries to convert words to a float, but if that fails, an exception is raised.  Run it outside of the debugger (compile, find .exe and run it from Windows Explorer) and you will be fine.

Otherwise, you can also go to Tools, Debugger options, 3rd tab (language), click on Add

EConvertError

(case sensitive - I think).  That will make the debugger ignore the try-except errors.
Hmm, I was trying to run it directly from Delphi, once i compiled the project and ran the .exe i got it right... Don't understand why i got error from delphi though... Some exceptions treatment missing maybe??
perfect