1

I've got a table of strings like i.e.:

START0001?sthEND1,
START002?sthEND2,
START03?sthEND3,
START4

How could I obtain the table:

START1,
START2,
START3,
START4
?

I can do this with gsub(sub('^([^?]+)*','',napis),"",napis) but there is a problem with "?" sign that stays after all.

1 Answers1

0

Try this:

y<-"START0001?sthEND1"
x<-unlist(strsplit(y,""))
idx<-which(grepl("\\?",x))
x<-paste0(x[1:(idx-1)],collapse = "")
x<-gsub("0","",x)
Henry Navarro
  • 943
  • 8
  • 34