Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 如何在Rascal中删除字符串中的空白?_String_Whitespace_Trim_Rascal - Fatal编程技术网

String 如何在Rascal中删除字符串中的空白?

String 如何在Rascal中删除字符串中的空白?,string,whitespace,trim,rascal,String,Whitespace,Trim,Rascal,当你有一个像这样的流氓字符串: "\n\tThis is a specification of a toy Transaction.\n\tVia a transaction money can be transfered between two accounts\n" 或 我现在的解决方案是调用一个替换'\n'、'\t'和'\r'的函数,但这似乎不是一个可持续的解决方案。此外,函数trim仅删除开头和结尾处的空白 visit (x) { case /[\t\n]/ => ""

当你有一个像这样的流氓字符串:

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

<如何删除字符串中间的空白?< /p> 我现在的解决方案是调用一个替换'\n'、'\t'和'\r'的函数,但这似乎不是一个可持续的解决方案。此外,函数trim仅删除开头和结尾处的空白

visit (x) { 
  case /[\t\n]/ => "" 
}
visit (x) { 
  case /[\t\n]/ => "" 
}