I have seen a lot of code of a lot of developers during the past two decades. There is however one thing that even more seasoned developers keep getting wrong when it comes to using strings in code.
I see mixed uses of "" and '' as demonstrated in the two examples below. Both are programatically correct and are accepted by the compiler and both work fine.
public static str callerBufferIsMandatory()
{
return "The form has been called incorrectly. A caller buffer is required.";
}
Example 1 of a string with "".
public static str callerBufferIsMandatory()
{
return 'The form has been called incorrectly. A caller buffer is required.';
}
Example 2 of a string with ''.
Conclusion
Basically, if your string is used in the use interface towards the end user, you use "" for the string. Best practice is to use a label but this is another topic all together and not covered here.
If your string is not used in the user interface and is a basically a constant that won't change and will never be converted to a label, you use '' for the string. Like the example below. The name is a constant and will never change.
public static void writeLog(str _text)
{
new SysExceptionLog().writeEntry(Exception::Info, _text, 'MyCustomizationName');
}