Any time someone asks "How do I use X to do Y", I want to SCREAM at the top of my lungs "STOP!!!"
Your question is like saying "How do I use a hammer to drill a 1.5cm hole in a wall?" Don't decide on the tool first and then figure out how to make it do what you need done.
Look at what you need to to - analyse it, write down some specs, consider end- and corner-cases...and THEN look in your toolbox for something that can help you do that. Or ask a master carpenter what would be a good tool to do the job.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors