对不起,用这种格式的数据,如何根据给定规则切割字符串
对不起,用这种格式的数据,如何根据给定规则
数据切割字符串:
切割字符串
{
'content': 'key1vip has been serving you for 2 days, and the customer service will provide you with professional answers and formulate solutions',
'keywords': [{
'keyword': 'key1',
'replaceKeyword': 'On',
'link': '',
'color': '',
}, {
'keyword': 'key2',
'replaceKeyword': '30',
'link': '',
'color': '',
}]
}
如何根据给定规则转换为以下格式
const _array = [
{text: 'Already for you'},
{text: 'on', link: '', color: ''},
{text: 'vip service'},
{text: '30', link: '', color: ''},
{text: 'days, customer service will provide you with professional answers and make plans'},
]
Excuse me, with data in this format, how to cut the string according to the given rules
data:
how to cut the string according to the given rules
{
'content': 'key1vip has been serving you for 2 days, and the customer service will provide you with professional answers and formulate solutions',
'keywords': [{
'keyword': 'key1',
'replaceKeyword': 'On',
'link': '',
'color': '',
}, {
'keyword': 'key2',
'replaceKeyword': '30',
'link': '',
'color': '',
}]
}
Convert to the following format
const _array = [
{text: 'Already for you'},
{text: 'on', link: '', color: ''},
{text: 'vip service'},
{text: '30', link: '', color: ''},
{text: 'days, customer service will provide you with professional answers and make plans'},
]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下方法对您的当前数据格式有效。您需要调试其他格式。
The following method is valid for your current data format. You need to debug other formats.