How to resolve the algorithm Rosetta Code/Fix code tags step by step in the R programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Rosetta Code/Fix code tags step by step in the R programming language
Table of Contents
Problem Statement
Fix Rosetta Code deprecated code tags, with these rules:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Rosetta Code/Fix code tags step by step in the R programming language
Source code in the r programming language
fixtags <- function(page)
{
langs <- c("c", "c-sharp", "r") # a complete list is required, obviously
langs <- paste(langs, collapse="|")
page <- gsub(paste("<(", langs, ")>", sep=""), "<lang \\1>", page)
page <- gsub(paste("</(", langs, ")>", sep=""), "</#####lang>", page)
page <- gsub(paste("<code(", langs, ")>", sep=""), "<lang \\1>", page)
page <- gsub(paste("</code>", sep=""), "</#####lang>", page)
page
}
page <- "lorem ipsum <c>some c code</c>dolor sit amet,<c-sharp>some c-sharp code</c-sharp>
consectetur adipisicing elit,<code r>some r code</code>sed do eiusmod tempor incididunt"
fixtags(page)
You may also check:How to resolve the algorithm Function definition step by step in the Gnuplot programming language
You may also check:How to resolve the algorithm Sequence: smallest number with exactly n divisors step by step in the Raku programming language
You may also check:How to resolve the algorithm Feigenbaum constant calculation step by step in the Perl programming language
You may also check:How to resolve the algorithm Yin and yang step by step in the Logo programming language
You may also check:How to resolve the algorithm Pascal's triangle step by step in the RapidQ programming language