1
0
mirror of https://github.com/sasjs/core.git synced 2025-12-10 22:14:35 +00:00

fix: trim edge cases and return of the register client url

This commit is contained in:
vrh
2020-09-11 00:38:37 +02:00
parent 7b72f0ac94
commit 91983e0a91
3 changed files with 28 additions and 8 deletions

View File

@@ -23,13 +23,23 @@
**/
%macro mf_trimstr(basestr,trimstr);
%local trimlen trimval;
%local baselen trimlen trimval;
/* return if basestr is shorter than trimstr (or 0) */
%let baselen=%length(%superq(basestr));
%let trimlen=%length(%superq(trimstr));
%if &baselen < &trimlen or &baselen=0 %then %return;
/* obtain the characters from the end of basestr */
%let trimval=%qsubstr(%superq(basestr)
,%length(%superq(basestr))-&trimlen+1
,&trimlen);
%if %superq(trimval)=%superq(trimstr) %then %do;
/* compare and if matching, chop it off! */
%if %superq(basestr)=%superq(trimstr) %then %do;
%return;
%end;
%else %if %superq(trimval)=%superq(trimstr) %then %do;
%qsubstr(%superq(basestr),1,%length(%superq(basestr))-&trimlen)
%end;
%else %do;