The operations you describe are simplified by the methods available for Strings or arrays of characters. With the little bit I know about the problem, I would suggest that approach.