打破 JavaScript 中的模板文字字符串
Break a Template Literals String in JavaScript
我在 IFTTT 中制作了一个小程序,它使用 Instagram.anyNewPhotoByYou.Caption
获取我最新的 Instagram post 的标题。
我所有的 Instagram 字幕都由 4 个段落组成。
此代码将标题存储在模板文字多行字符串中:
const x = `${Instagram.anyNewPhotoByYou.Caption}`;
我想将多行标题分成 4 个字符串(每个字符串包含我的标题的 1 段)。
有什么办法吗?
来源:
- Template Literals
- My Instagram account(如果你想看我的post的任何标题)
确保 Instagram.anyNewPhotoByYou.Caption
的段落由换行符分隔。然后使用spilt方法,
const x = `${Instagram.anyNewPhotoByYou.Caption}`;
let paras = x.split('\n');
我在 IFTTT 中制作了一个小程序,它使用 Instagram.anyNewPhotoByYou.Caption
获取我最新的 Instagram post 的标题。
我所有的 Instagram 字幕都由 4 个段落组成。
此代码将标题存储在模板文字多行字符串中:
const x = `${Instagram.anyNewPhotoByYou.Caption}`;
我想将多行标题分成 4 个字符串(每个字符串包含我的标题的 1 段)。
有什么办法吗?
来源:
- Template Literals
- My Instagram account(如果你想看我的post的任何标题)
确保 Instagram.anyNewPhotoByYou.Caption
的段落由换行符分隔。然后使用spilt方法,
const x = `${Instagram.anyNewPhotoByYou.Caption}`;
let paras = x.split('\n');