2

When you have a string in Rascal like this:

"\n\tThis is a specification of a toy Transaction.\n\tVia a transaction money
can be transfered between two accounts\n"

Or

        This is a specification of a toy Transaction.
        Via a transaction money can be transfered between two accounts

How can I remove the whitespace in the middle of the string?

My solution now is to call a function that replaces '\n', '\t', and '\r' but this doesn't seem like a sustainable solution. Also, the function trim only remove whitespace at the beginning and end.

1 Answers1

2
visit (x) { 
  case /[\t\n]/ => "" 
}
Jurgen Vinju
  • 6,393
  • 1
  • 15
  • 26