开发者

Best practice / design pattern for a vcard/mecard parser?

开发者 https://www.devze.com 2023-02-25 02:36 出处:网络
I have implemented a VCARD parser in objective c. Now I want to add support for the MECARD standard. The only difference of a VCARD and a MECARD are the different 开发者_开发知识库separators between t

I have implemented a VCARD parser in objective c. Now I want to add support for the MECARD standard. The only difference of a VCARD and a MECARD are the different 开发者_开发知识库separators between the fields. Now I'm looking for a good design pattern that helps me to combine both standards into one parser.

Are there any best practices or design patterns for such text parsers?


If your main difference is the separator, abstract it out by creating a parse function that takes your raw input and converts it into an array or some other data structure that does not need separators.

0

精彩评论

暂无评论...
验证码 换一张
取 消