If so, how can i change the following code:
(script-path (tbnl::enough-url (ppcre:regex-replace-all "\\\\" script-name "/") uri-prefix))
thanks!
Maybe you are looking for this?
CL-USER> (puri:render-uri
(puri:enough-uri "http://foo.bar.com/baz/blub"
"http://foo.bar.com/")
nil)
"/baz/blub"
Related
My code is:
snipername = str(input("What's the Sniper's name again?"))
print ("That's right,(snipername)! ")
(snipername) is my varible, but i can't figure out how to print it as well as the message.
Any help would be greatly apprectiated!
Use print("That's right, %s!" % (snipername))
I would like to return "blah".
url <- "https://www.example.com/apples/pears/blah.csv"
I can get blah but I feel like I'm writing more lines of code than I should. Example, to get blah.csv I can do:
url_split <- str_split(url, "/")
dirname <- url_split[[1]][length(url_split[[1]])]
This gives me "blah.csv", where I can do a very similar code block as above to get "blah" by calling str_split again.
Is there a more sophisticated one liner to get the last directory in the url minus ".csv"?
fn <- basename("https://www.example.com/apples/pears/blah.csv")
gsub("\\..*$", "", fn)
I want to add two tab-divisions into a tsv file after First+Last name (\nJohn Smith\t) occurrence:
dl=readstring(fileName)
dl=replace(dl,r"(\n[A-Za-z\s]+\t)","\1\t\t")
I get First+Last Name replaced by x01. The docs say something about substitution string but I can't find the implementation
Update: this substitutes for a group
dl=replace(dl,r"(\n[A-Za-z\s]+\t)",s"\1")
But this:
dl=replace(dl,r"(\n[A-Za-z\s]+\t)",s"\1\t\t")
results in an error Bad Replace. Symbols without \ seem fine.
It seems like bug to me. But you could use workaround:
julia> dl = "\nJohn Smith\t";
julia> s = Base.SubstitutionString;
julia> dl=replace(dl, r"(\n[A-Za-z\s]+\t)", s("\\1\t"))
"\nJohn Smith\t\t"
edit:
I think this is better:
julia> dl = "\nJohn Smith\t";
julia> dl=replace(dl, r"(\n[A-Za-z\s]+\t)", #s_str("\\1\t"))
"\nJohn Smith\t\t"
BTW if you want to append number after capture group then you could do other trick (named groups):
julia> replace("aAa", r"(?<one>A+)", s"\g<one>1")
"aA1a"
I try to parse out the xmlValue for the attribute "NAME" in an XML Document in R.
<NN ID_NAME="107232" ID_NTYP="6" NAME="dSpace_ECat1Error.STS" KOMMENTAR="dSpace_ECat1Error.STS" IS_SYSTEM="0" IS_LOCKED="0" DTYP="Ganzzahl" ADIM="" AFMT=""/><NN ID_NAME="107233" ID_NTYP="6" NAME="dSpace_ECat2Error.STS" KOMMENTAR="dSpace_ECat2Error.STS" IS_SYSTEM="0" IS_LOCKED="0" DTYP="Ganzzahl" ADIM="" AFMT=""/>
The result should be like this:
dSpace_ECat1Error.STS
dSpace_ECat2Error.STS
I use this function:
xpathSApply(root,"//NN[#NAME]",xmlValue)
But as a result, I get just empty "" (Quotes)
What have I done wrong?
Thank's in advance!
I just found out by using:
erg<-xpathSApply(root,"//NN",xmlGetAttr,'NAME')
There should be a better tutorial for this particular XML-function in R....
#springFormInput("userForm.password" 'type="password"') is not working;
is it correct?
Use #springFormPasswordInput("userForm.password" "")
(list of all macros)