grails – Groovy中的三重单引号字符串 – 结果字符串是否应包含
发布时间:2020-12-14 16:27:04 所属栏目:大数据 来源:网络整理
导读:如果我使用以下groovy代码: description: '''Join the Perl programmers of the Pork Producers of America as we hone our skills and ham it up a bit. You can show off your programming chops while trying to win a year's supply of pork chops in o
如果我使用以下groovy代码:
description: '''Join the Perl programmers of the Pork Producers of America as we hone our skills and ham it up a bit. You can show off your programming chops while trying to win a year's supply of pork chops in our programming challenge. Come and join us in historic (and aromatic),Austin,Minnesota. You'll know when you're there!''' 是不是groovy应该创建一个只有行之间的单个空格的长字符串(意味着不保留行之间的空格)?结果字符串将是: 加入美国猪肉生产商的Perl程序员,因为我们磨练我们的技能并加以改进……等等 我得到的字符串包含行之间的所有空格.这是预期的行为吗? 解决方法
从Groovy 1.7.3开始:
def description = ''' Join the Perl programmers of the Pork Producers of America as we hone our skills and ham it up a bit. You can show off your programming chops while trying to win a year's supply of pork chops in our programming challenge. Come and join us in historic (and aromatic),Minnesota. You'll know when you're there!'''.stripIndent() (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
- Learning Perl: 3.1. Accessing Elements of an
- 【复杂网络系列】HipHop算法:利用微博互动关系挖
- [Lua源码阅读] 理解Lua的object
- POJ 1053 Integer Inquiry (大数加法,还是Java大
- Golang - 阿里大于最新sdk 2017-05-25
- ThinkPHP3.1基础知识快速入门
- delphi xe5 android 开发实现手机打电话和发短信
- perl6 – 使用SourceBaby的语法和正确方法是什么
- Perl dbi sqlite’select * ..’只返回第一个ele
- Lua实现计算 UTF8 字符串的长度,每一个中文算一
热点阅读