Forums
The students are really complaining about the way the quote (') has to be escaped in RPG compared to other languages. I really never thought about it until now.
The point I was making on the escape character for quote was that the students think it is strange that they have to use '''''''''' in the SELECT string to get a quote.
Re: Update on RPG71
Other languages (like Python) have the "long string notation" with """ so the string continues until a matching """ is found. Other languages (like JavaScript) can flex between " or ' for the string so it makes most sense in the context. RPG however has none of the above – RPG is rather new to string manipulation and still has place for improvement.
There is a way around it though:
I use a constant named q which has one quote and then connect that into the string. Then just "read" ' when you see a q:
Another way around it is to make a procedure that returns quotes around the string:
Where quotes look something like:
In both of the above you have isolated the ugly '''' for one quote into a designated place…
The last way is to implement the " / ' switching – so you can use another chart for the quote and then %xlate it to the quote at runtime:
This however is a little error prone. What if you need the " in string – then it also becomes single quotes.
Best regards,
Niels Liisberg