Home

Newline and control characters should not be used in string literals

Description

    This rule states that when writing string literals in PowerBuilder code, newline and control characters should not be used. This is because these characters can cause unexpected behavior in the program, and can also be difficult to debug. It is best to stick to standard characters such as letters, numbers, and punctuation when writing string literals.

Key Benefits

  • No confusion: Using newline and control characters in string literals can cause confusion when interpreting the code.
  • Easier debugging: It is much easier to debug code when newline and control characters are not used in string literals.
  • More secure: Not using newline and control characters in string literals helps to make the code more secure.

 

Non-compliant Code Example

function string TestFunctionTest(int cnt)

string @count = "Hello //Non compliant code
world!";

return ""

end function

Compliant Code Example

function string TestFunctionTest(int cnt)

string @count = "Hello world!"; //Compliant code

return ""

end function
Visual Expert 2024
 VEPBRULE33