I have a query request-uri in the form of "/node/143" (just an example of the format).
I want to strip the first forward slash from the string, I looked up the function remove and had a try. I just can't seem to get it working (I'm using SBCL on Linux).
I've set the request-uri using this code.
(setq request-uri "/node/143")
When I check the variable I have this returned.
request-uri
"/node/143"
I now try to remove the first slash (at this point it's just anything at all to see how the function is properly used).
(remove "/" request-uri)
"/node/143"
(remove '/ request-uri)
"/node/143"
I even tried supplying a list
(remove '("/") request-uri)
"/node/143"
(remove '('/) request-uri)
"/node/143"
Even though strings are vectors of characters I thought that somehow maybe the whole string may be placed in one cell and I tried to remove the whole thing, still no luck.
(remove "/node/143" request-uri)
"/node/143"
(remove '/node143 request-uri)
"/node/143"
So I'm at a loss right now, this seemingly simple function has really eluded me, I thought I followed the documentation to the letter, but nothing is working.
Can anyone shed some light on what's happening here?
Thanks.
Edit: I found the answer to my question, which raised another question.
To remove an element from the string I used
(remove #\/ request-uri)
What about a whole string
`(remove #\node request-uri`)
Only works for the first character and throws an error, and the following all do nothing.
(remove "node" request-uri)
(remove 'node request-uri)
(remove ?\node request-uri)
(remove #\node request-uri)
(remove '("node") request-uri)
I'm not sure how else it should be addressed here.