小编Rob*_*bin的帖子

在 javascript 中比较大字符串与大字符串数组是否有 3 个或更多连续单词匹配

我有一个大字符串(1000 个单词),我想将其与数组的所有元素进行比较,该数组也包含大字符串,以获取所有 3 个或更多连续单词匹配。我已经用正则表达式实现了它,但得到了空白匹配数组。

较小文本的示例:

let textToCompare = "Hello there how are you doing with your life";

let textsToCompareWith= [
  { id:1, text:"Hope you are doing good with your life" },
  { id:2, text:"what are you doing with your life. hello there how are you" },
  { id:3, text:"hello there mate" }
];
Run Code Online (Sandbox Code Playgroud)

预期输出:

[
  {id:1, matchedText:["with your life"]}, 
  {id:2, matchedText:["are you doing with your life","hello there how are you"]},
  {id:3, matchedText:[]}
];
Run Code Online (Sandbox Code Playgroud)

电流输出:

[
  {id:1, matchedText:[]}, 
  {id:2, matchedText:[]},
  {id:3, …
Run Code Online (Sandbox Code Playgroud)

javascript regex string-comparison

5
推荐指数
1
解决办法
91
查看次数

无法将参数类型“ MaterialColor”分配给参数类型“ Paint”

在此处输入图片说明

我想将背景色设置为红色,但是TextStyle小部件下没有'backgroundColor'属性。

有背景属性,但我无法设置背景值。它显示错误,错误是

无法将参数类型“ MaterialColor”分配给参数类型“ Paint”

我知道这个错误是合理的。但是背景属性的值应该是多少?

我搜索但很遗憾找不到:(我可以将background设置为background: Paint(),并且背景变为黑色。但是我需要红色background。background 的值应该是多少?

谢谢

android dart flutter flutter-layout

1
推荐指数
1
解决办法
851
查看次数

在 ReactJS 中删除 logo.svg 文件后出错

通常,在使用 creat-react-app 创建项目后,会包含一个名为 logo.svg 的文件。我不想在我的项目中使用 react 的标志。所以我从我的项目中删除了这个文件。但删除后显示错误!截图附在下面 - 错误截图

为什么会发生?有没有办法解决这个问题?它显示打开一个目录 D:\React\cafe-4-4-2\node_modules\react-scripts\config\polyfills.js;但是 node_modules 下没有名为 react-scripts 的目录!

我试过(删除 logo.svg)在 3 个不同的项目中删除这个文件,每次它都显示相同的错误!

svg reactjs

-1
推荐指数
1
解决办法
1881
查看次数