forked from vlachoudis/brexx
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathUNQUOTE.rexx
23 lines (23 loc) · 926 Bytes
/
UNQUOTE.rexx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* ---------------------------------------------------------------------
* UNQUOTE String (remove delimeters from string)
* Unquote(string)
* if 1. char is " and last char is " they will be removed
* if 1. char is ' and last char is ' they will be removed
* if 1. char is ( and last char is ) they will be removed
* if 1. char is < and last char is > they will be removed
* ...............................Created by PeterJ on 11. December 2018
* ...............................Amended by PeterJ on 30. March 2019
* ---------------------------------------------------------------------
*/
UNQuote: procedure
parse arg unq
_n=length(unq)
_f=substr(unq,1,1)
_l=substr(unq,_n,1)
if _f='"' & _l='"' then _u=1
else if _f="'" & _l="'" then _u=1
else if _f='(' & _l=')' then _u=1
else if _f='<' & _l=">" then _u=1
else if _f='[' & _l="]" then _u=1
if _u=1 then return substr(unq,2,_n-2)
return unq