以前js拼接字符串有好多 \n \t

不使用ES6

使用“\n\t”将多行字符串拼接起来:

var roadPoem = 'Then took the other, as just as fair,\n\t'
+ 'And having perhaps the better claim\n\t'
+ 'Because it was grassy and wanted wear,\n\t'
+ 'Though as for that the passing there\n\t'
+ 'Had worn them really about the same,\n\t'

使用ES6

将多行字符串放在反引号``之间就好了:

var roadPoem = `Then took the other, as just as fair,
And having perhaps the better claim
Because it was grassy and wanted wear,
Though as for that the passing there
Had worn them really about the same,`

ES6确实很好啊

使用“\n\t”将多行字符串拼接起来的更多相关文章

  1. js中多行字符串拼接

    前言 我们会经常遇到这样的场景,需要拼接多行字符串,在字符串中动态插入一些数据以达到业务的需求.但是js中并没有标准的多行编辑的函数,于是聪明的程序员们便脑洞大开,书写出许多有趣的方法. 1 2 3 ...

  2. [转]hive中自定义函数(UDAF)实现多行字符串拼接为一行

    函数如何使用: hive> desc concat_test;OKa       intb       string hive> select * from concat_test;OK1 ...

  3. Python字符串拼接的6种方法(转)

    add by zhj: 对于多行字符串连接,第6种连接方法很方便,连接时不会添加额外的空格. 原文:http://www.cnblogs.com/bigtreei/p/7892113.html 1. ...

  4. Python字符串拼接的6种方法

    如有其他字符串拼接方法 欢迎留言提出哦 (示例版本为Py2) 1. 加号 第一种,有编程经验的人,估计都知道很多语言里面是用加号连接两个字符串,Python里面也是如此直接用 “+” 来连接两个字符串 ...

  5. 【Python学习笔记】字符串拼接方法(5种)总结

    字符串的 5 种拼接方法: “+”号 “,”号 直接连接 格式化 多行字符串拼接 第一种:“+”号 print("Hello"+"Python") 打印结果: ...

  6. 关于SQL Server将一列的多行内容拼接成一行的问题讨论

    http://blog.csdn.net/rolamao/article/details/7745972 昨天遇到一个SQL Server的问题:需要写一个储存过程来处理几个表中的数据,最后问题出在我 ...

  7. java 创建string对象机制 字符串缓冲池 字符串拼接机制

    对于创建String对象的机制,在这一过程中涉及的东西还是值得探究一番的. 首先看通过new String对象和直接赋值的方式有什么区别,看如下代码: public static void main( ...

  8. SQL Server将一列的多行内容拼接成一行的问题讨论

    转自http://blog.csdn.net/rolamao/article/details/7745972 昨天遇到一个SQL Server的问题:需要写一个储存过程来处理几个表中的数据,最后问题出 ...

  9. Python 基础 字符串拼接 + if while for循环

    注释单行注释 #多行注释 ''' 三个单引号或者三个双引号 """ ''' 用三引号引住可以多行赋值 用户交互 input 字符串拼接 +  ""%( ...

随机推荐

  1. oracle: listener.ora 、sqlnet.ora 、tnsnames.ora的配置及例子

    1.解决问题:TNS或者数据库不能登录.      最简单有效方法:使用oracle系统提供的工具 netca 配置(把原来的删除掉重新配置)     $netca  2.然而,仍有疑问:如何指定'l ...

  2. JavaScript正则(一)

    1.字符组: ^  $ 说的是开始位置和结束位置,在JS中,既表示字符串的起始位置和结束位置,也表示行的起始位置和结束位置 console.log(/^\d$/.test('2')); // true ...

  3. jquery操作DOM 元素(2)

    .after() 在匹配的元素集合中的每个元素后面插入参数指定的内容,作为其兄弟节点. .after(content[,content]) content HTML字符串 DOM 元素 元素数组 对象 ...

  4. Android学习<2>

    Android自学资料汇总 资料参考地址: http://blog.csdn.net/guolin_blog/article/details/26365913 http://drakeet.me/an ...

  5. poj_1320_Street Numbers

    A computer programmer lives in a street with houses numbered consecutively (from 1) down one side of ...

  6. Open closed principle

    #include <iostream> using namespace std; class Book { public: string getContents() { return &q ...

  7. Springcloud Eureka 启动失败:ERROR org.springframework.boot.SpringApplication - Application run failed

    在测试Euruka作为服务注册中心的时候碰到了这个问题 [main] ERROR org.springframework.boot.SpringApplication - Application ru ...

  8. Python学习之三级菜单

    Python经典练习题 - 三级菜单 需求: 可依次选择进入各子菜单 可从任意一层往回退到上一层 可从任意一层退出程序 示例代码: # -*- coding: utf-8 -*- menu = { ' ...

  9. vue数据绑定html

    html标签的纯文本显示/被当做html标签处理: 1)使用两个大括号时,假如字符串内容是html标签,那么不会被转义: 2)使用三个大括号时,字符串内的html标签会被直接转义 a.两个大括号: & ...

  10. js 判断function是否存在

    function myFunction(){ }//方法一 if(typeof(myFunction) == 'function'){ //function }else{ //undefined }/ ...