我想在我的 React 应用程序上提取 Json 中段落中的特定句子。例如 -
groupinfo: this is the groups info
errorInfo: "imagine this is a long paragraph within a Json file, and i want to display/pull just a small part of it. so for instance i want just (long paragraph) and I want to know how to just pull that one part of the paragraph"
我想用段落的这一小部分来完成一个网络链接,因此它使用的小句子需要是可变的,并根据json中的artifactID来确定。
如果这可行的话,它会只提取 Json 中段落的一小部分,并将其显示为网站的链接。如果我需要做更多解释,请告诉我。
最佳答案
如果你用子字符串来获取它怎么办?
const myStr = 'Alligator';
const myNewStr = myStr.substring(0, 3);
console.log(myNewStr); // All
关于javascript - 如何在我的 React 应用程序上提取 json 段落中的特定句子?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51497442/