Click here to Skip to main content
15,036,441 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello, newbie here. So I need to compare two paper formats, for example A4 and A2, that are in a .txt file. I'm guessing there isn't a command for paper format comparison, so do I need to split the character(A) form the number(4)? If so, how do I do this?

What I have tried:

I don't know how to approach this problem
Posted
Updated 7-Nov-20 1:21am
Comments
BillWoodruff 7-Nov-20 7:00am
   
Describe what "compare" means: how does an A3 page format compare to A4 ?
Richard MacCutchan 7-Nov-20 7:05am
   
The question is impossible to answer without knowing the structure of the text file. Is it just lines of text containing lists of paper sizes, or something more complex?
PIEBALDconsult 8-Nov-20 11:37am
   
Regular Expressions

1 solution

Quote:
I don't know how to approach this problem

Start by looking at your text file and working out exactly what is in there: how is it organised? What data does it contain?
Work out what separates one "paper format" from another: if all the information for A4 is on one line and all the information for A3 is on another, than that is a simple line based format, which makes it easy to separate data items, and that's the first step.

Once you have worked that out - and remember that no code is needed yet - look at each separate data item, and work out what it contains. If it's just the name of the paper size ("A4" or "A3") than that's trivial - if it's also the actual size ("210mm x 297mm", "297mm x 420mm"), or it also contains margin info for example, then repeat the above for each data item to work out what separates them, what defines "this is the width" from "this is the top margin"?

Work that out, and starting to code to read the file becomes fairly easy. But without it, you - and by extension us - are severely lacking in information to solve this at all!
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900