Which style of Ruby string quoting do you favour?

后端 未结 9 1808
挽巷
挽巷 2020-11-30 00:31

Which style of Ruby string quoting do you favour? Up until now I\'ve always used \'single quotes\' unless the string contains certain escape sequences or interp

9条回答
  •  盖世英雄少女心
    2020-11-30 00:56

    Don't use double quotes if you have to escape them. And don't fall in "single vs double quotes" trap. Ruby has excellent support for arbitrary delimiters for string literals:

    Mirror of Site - https://web.archive.org/web/20160310224440/http://rors.org/2008/10/26/dont-escape-in-strings

    Original Site - http://rors.org/2008/10/26/dont-escape-in-strings

提交回复
热议问题