Hi there, I'm currently writing code for a translator. The task is to open a file from anywhere on my network, then display it and then allow to save the file. So far I have a window that allows a user to browse for a file, open the file and save it, however, the file needs to be in a certain format, eg, not the form it is saved on the drive as.
Example : One line from the file is
R0001: C0001 + C0002 <=> C0003
these are reactions, products and reactants, the program is required to re-organise these into a different layout:
R0001(C0001 + C0002, C0003)
owever I'm slightly stuck on how to do this. Any help would be brilliant.
Thanks in advance

Recommended Answers

All 2 Replies

Hi there, I'm currently writing code for a translator. The task is to open a file from anywhere on my network, then display it and then allow to save the file. So far I have a window that allows a user to browse for a file, open the file and save it, however, the file needs to be in a certain format, eg, not the form it is saved on the drive as.
Example : One line from the file is
R0001: C0001 + C0002 <=> C0003
these are reactions, products and reactants, the program is required to re-organise these into a different layout:
R0001(C0001 + C0002, C0003)
owever I'm slightly stuck on how to do this. Any help would be brilliant.
Thanks in advance

think of creative ways to count ;), spaces, letters etc. For example if you know u will need to format right after the colon start from there, or in your first format place special sentinals.

It seems to me, you could use spaces as a tokenizer deliminator. Then just use substring searches to find out if a string containts : or stuff like that, then delete that character. Then it's just a mater of rebuilding the correct format which shouldn't be at all hard.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.