codes <- c("0002-01014", "0020-0014","00014-00010", "00000-122345")gsub("\\b0+\\B", "", codes)
Standard input is empty
[1] "2-1014" "20-14" "14-10" "0-122345"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!