( block: Block, generator: DartGenerator, )
| 78 | } |
| 79 | |
| 80 | export function text_indexOf( |
| 81 | block: Block, |
| 82 | generator: DartGenerator, |
| 83 | ): [string, Order] { |
| 84 | // Search the text for a substring. |
| 85 | const operator = |
| 86 | block.getFieldValue('END') === 'FIRST' ? 'indexOf' : 'lastIndexOf'; |
| 87 | const substring = generator.valueToCode(block, 'FIND', Order.NONE) || "''"; |
| 88 | const text = |
| 89 | generator.valueToCode(block, 'VALUE', Order.UNARY_POSTFIX) || "''"; |
| 90 | const code = text + '.' + operator + '(' + substring + ')'; |
| 91 | if (block.workspace.options.oneBasedIndex) { |
| 92 | return [code + ' + 1', Order.ADDITIVE]; |
| 93 | } |
| 94 | return [code, Order.UNARY_POSTFIX]; |
| 95 | } |
| 96 | |
| 97 | export function text_charAt( |
| 98 | block: Block, |
nothing calls this directly
no test coverage detected