Better use HashTable or switch case

前端 未结 3 1597
无人及你
无人及你 2021-01-07 13:58

I\'m not sure which one is better. I need to parse each character of an input string and get a replacing string for the character. For some objects all alphanumeric characte

3条回答
  •  心在旅途
    2021-01-07 14:54

    I'd use the HashTable, because the code is more readable and maintainable: you could one day decide to load the subtitution strings from an XML file, so that you won't change the code to change the mappings.

提交回复
热议问题