Is it possible to keep the literal separator while using split() on a string in rascal?
For example,
split("/*", line)
Join Stack Overflow to learn, share knowledge, and build your career.
Is it possible to keep the literal separator while using split() on a string in rascal?
For example,
split("/*", line)
I was able to create my own split function. It is not perfect, but it seems to solve the issue that I was facing earlier.
public list[str] splitString(list[str] fileLines)
{
list[str] splitList = [];
for(line <- fileLines)
{
if( /^<x:.*>\/\*<y:.*>$/ := line)
{
splitList = splitList + x;
splitList = splitList + "/*";
splitList = splitList + y;
}
else if(/^<x:.*>\*\/<y:.*>$/ := line)
{
splitList = splitList + x;
splitList = splitList + "*/";
splitList = splitList + y;
}
else
{
splitList = splitList + line;
}
}
return splitList;
}