Code for checking over 1,000 sentences
Does Javascript have a built in CSS index I can check a sentence against?
At the moment…
If I wanted to check the sentences below for CSS properties, I have to create an array with ……(( ALL )) the CSS properties. Then check each sentence against the entire array.
Array
css_checker = [
"width","height","background","background color", "text decoration line", "right",
"table layout", "page break before", //and on… and… on and on………………
// I really don't want to use this array
// Using this is like a last resort
// I was hoping for a better way than this
]
Input
a = "A CSS property named animation fill mode is in this string"
b = "There are no CSS properties in this string"
c = "Width, height, and animation properties are in this string"
d = "Column rule width and transform origin are in this string"
Matchs
a: A CSS property named animation fill mode is in this string
b: There are no CSS properties in this string
c: Width, height, and animation properties are in these string
d: Column rule width and transform origin are in these string
Output
a: true
b: false
c: true
d: true
How to use it
if ( /*Sentence has CSS property*/ ) {
//run this code
}
What I'm trying to do is
Find out where the first CSS property is located… and then split it at that point.
Example
Input
A CSS property named animation fill mode and width is in this string
Match
A CSS property named animation fill mode and width is in this string
Output
animation fill mode and width is in this string