‎2015 May 10 11:23 AM
Hi everyone,
I am trying to insert the character ' into a string, but I don't know how I can put that because it is a special character.
Any ideas?
Thanks!
‎2015 May 10 3:37 PM
Dear Marta,
two apostrophe characters represent one apostrophe on the output.
This means: if you put '' in the string, it will be interpreted as a single ' .
Best regards,
Laszlo
‎2015 May 10 4:07 PM
Hi Marta,
You can exemplify best at what time you want to place "?
I ask this because the procedure is quite simple in some situations, such as concatenate I show below:
DATA: a TYPE string,
b TYPE string,
string TYPE string.
a = 'CONCATENATE'.
b = 'TEST'.
CONCATENATE '"' a '"' b INTO string SEPARATED BY space.
WRITE: / string.
I await your considerations.
‎2015 May 10 5:31 PM
Exactly, I want to split at symbol ', so i need that this symbols not works as special character.
‎2015 May 10 6:18 PM
So, create a constant that has this value and use the split, as I show below:
CONSTANTS c_quot VALUE `'`.
CLEAR: a, b.
SPLIT string AT c_quot INTO a b c.
BR,
Raphael Pacheco.
‎2015 May 10 7:28 PM
this solution not works because when I put:
a type string value ''' (three apostrophe characters), the first open the string, the second close the string, and the thirst open again as we would want to put onether one. But I want to put this character in the string.
I mean, I need the symbol which means "ignore this character", as the symbol \ in java.
‎2015 May 10 7:36 PM
The solution is used the characters `` and put inside the another ', because the open symbol is diferent and the program search the same symbol, so you can put inside the another symbol.
I dont know if I explain well but this is the solution.
Thanks.
‎2015 May 11 4:20 AM
Hi Marta,
Two single quotes represent one single quote for such purposes. So, you need to mention four single quotes in a row.
Example:
DATA : L_VA1 TYPE C LENGTH 8,
L_VA2 TYPE C LENGTH 8.
CONSTANTS : L_QT TYPE C LENGTH 1 VALUE ''''.
SPLIT P_CHAR AT L_QT INTO L_VA1 L_VA2.
" Assume P_CHAR contains string like VIJAY'KRIS.
Result: VIJAY
KRIS
Regards,
Vijay