From 3b601e8595a7c9d3670d59d9b40bc98ff7cbe668 Mon Sep 17 00:00:00 2001 From: Ken Date: Fri, 11 Aug 2017 00:52:41 +1200 Subject: [PATCH] Add string contains string --- src/blocks/scratch3_operators.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/blocks/scratch3_operators.js b/src/blocks/scratch3_operators.js index 812fd6bb9..01cae80dc 100644 --- a/src/blocks/scratch3_operators.js +++ b/src/blocks/scratch3_operators.js @@ -30,6 +30,7 @@ class Scratch3OperatorsBlocks { operator_join: this.join, operator_letter_of: this.letterOf, operator_length: this.length, + operator_contains: this.contains, operator_mod: this.mod, operator_round: this.round, operator_mathop: this.mathop @@ -106,6 +107,10 @@ class Scratch3OperatorsBlocks { length (args) { return Cast.toString(args.STRING).length; } + + contains (args) { + return Cast.toString(args.STRING1).includes(Cast.toString(args.STRING2)); + } mod (args) { const n = Cast.toNumber(args.NUM1);