Posted: Sat Jan 18, 2003 7:04 pm
Restored from previous forum. Originally posted by ebs.
I prefer to use constants like #DoubleQuote instead of Chr(34). I think it makes your code easier to understand.
The history file for PB 3.50 says:
- Optimized: the code generation: Chr(#Constant) is now considered as a litteral string and some speed enhancements
This led me to believe that the following code would be OK:
Is it possible to create a string constant using Chr(), or another method? I know I could create a variable and set it equal to Chr(34), but it makes more sense to use a string constant.
Eric
I prefer to use constants like #DoubleQuote instead of Chr(34). I think it makes your code easier to understand.
The history file for PB 3.50 says:
- Optimized: the code generation: Chr(#Constant) is now considered as a litteral string and some speed enhancements
This led me to believe that the following code would be OK:
Code: Select all
#Underscore = "_"
#DoubleQuote = Chr(34)
String1.s = Chr(34) + "Hello!" + Chr(34)
MessageRequester("String Constant Test", "String1 = " + String1, 0)
; produces String1 = "Hello!" GOOD
String2.s = #Underscore + "Hello!" + #Underscore
MessageRequester("String Constant Test", "String2 = " + String2, 0)
; produces String2 = _Hello!_ GOOD
String3.s = #DoubleQuote + "Hello!" + #DoubleQuote
MessageRequester("String Constant Test", "String3 = " + String3, 0)
; produces String3 = 34Hello!34 BAD
End
Eric