This section provides some tips for using strings. The first applies to strings in all languages.
Issues for using magic characters and strings are similar to those for magic numbers discussed in Numbers in General.
Avoid magic characters and strings Magic characters are literal characters (such as ‘A’) and magic strings are literal strings (such as "Gigamatic Accounting Program") that appear throughout a program. If you program in a language that supports the use of named constants, use them instead. Otherwise, use global variables. Several reasons for avoiding literal strings exist:
For commonly occurring strings like the name of your program, command names, report titles, and so on, you might at some point ...