Yeah, i'm OK with the space. Once I've removed the "/" I append some more text to the URL.
In fact i'm running a Python script from COBOL, the script uses a URL as an input, then I redirect the output of the script to a file, that the COBOL program picks up and processes. So the final thing looks a little like:
Yeah, i'm OK with the space. Once I've removed the "/" I append some
more text to the URL.
In fact i'm running a Python script from COBOL, the script uses a URL
as an input, then I redirect the output of the script to a file, that
the COBOL program picks up and processes. So the final thing looks a
little like:
Hi folks,
I can't figure this one out.
As the title suggests. I have a string, if the last character of the string is a "/" then I want to remove it.
Can anyone suggest how I can do this?
Many thanks for any help and advice.
Hi, try looking at this post:
https://sourceforge.net/p/gnucobol/discussion/help/thread/b5d4124781/?limit=50#eaad
examine blogs replacing ALL "/" for space.
OR
move LENGTH-AM to fred (pic 999 or what ever the max size is)
if bloggs (fred:1) = "/" move space to bloggs (fred:1).
Using examine is a one liner.
Good point. My bad. The string is a URL so it contains multiple /'s
https://www.example.com/
I should have mentioned that.
In that case use option 1 - with the ALL sub-clause
It is faster to write anyway.
On 23/11/2023 15:18, Jason wrote:
RESOLVED.
So I removed the https://www. using SUBSTITUTE then replaced all remaining "/" with spaces, again using SUBSTITUTE.
That has its own problems unless you are happy to have a space within
text as your example of :
https://www.example.com/
will end up as "https: win.example.com "
sans the " of course.
On 23/11/2023 15:39, Jason wrote:
Yeah, i'm OK with the space. Once I've removed the "/" I append some more text to the URL.
In fact i'm running a Python script from COBOL, the script uses a URL as an input, then I redirect the output of the script to a file, that the COBOL program picks up and processes. So the final thing looks a little like:
myPythonScript.py https://www.example.com/robots.txt >> temp.file
I call that using SYSTEM.
The URLs come from a supplied text file, sometimes they end in "/" and sometimes not. So I parse the URLs to remove the "/" if it exists.
Thank you for your help!
On 23/11/2023 16:38, Jason wrote:
You are very welcome.