components/blockly-src/blocks/lists.js
function() {
    // Assign 'this' to a variable for use in the closures below.
    var thisBlock = this;
    var dropdown = new Blockly.FieldDropdown(
        [[Blockly.Msg.LISTS_SPLIT_LIST_FROM_TEXT, 'SPLIT'],
         [Blockly.Msg.LISTS_SPLIT_TEXT_FROM_LIST, 'JOIN']],
        function(newMode) {
          thisBlock.updateType_(newMode);
        });
    this.setHelpUrl(Blockly.Msg.LISTS_SPLIT_HELPURL);
    this.setColour(Blockly.Blocks.lists.HUE);
    this.appendValueInput('INPUT')
        .setCheck('String')
        .appendField(dropdown, 'MODE');
    this.appendValueInput('DELIM')
        .setCheck('String')
        .appendField(Blockly.Msg.LISTS_SPLIT_WITH_DELIMITER);
    this.setInputsInline(true);
    this.setOutput(true, 'Array');
    this.setTooltip(function() {
      var mode = thisBlock.getFieldValue('MODE');
      if (mode == 'SPLIT') {
        return Blockly.Msg.LISTS_SPLIT_TOOLTIP_SPLIT;
      } else if (mode == 'JOIN') {
        return Blockly.Msg.LISTS_SPLIT_TOOLTIP_JOIN;
      }
      throw 'Unknown mode: ' + mode;
    });
  }
function() {
    // Assign 'this' to a variable for use in the closures below.
    var thisBlock = this;
    var dropdown = new Blockly.FieldDropdown(
        [[Blockly.Msg.LISTS_SPLIT_LIST_FROM_TEXT, 'SPLIT'],
         [Blockly.Msg.LISTS_SPLIT_TEXT_FROM_LIST, 'JOIN']],
        function(newMode) {
          thisBlock.updateType_(newMode);
        });
    this.setHelpUrl(Blockly.Msg.LISTS_SPLIT_HELPURL);
    this.setColour(Blockly.Blocks.lists.HUE);
    this.appendValueInput('INPUT')
        .setCheck('String')
        .appendField(dropdown, 'MODE');
    this.appendValueInput('DELIM')
        .setCheck('String')
        .appendField(Blockly.Msg.LISTS_SPLIT_WITH_DELIMITER);
    this.setInputsInline(true);
    this.setOutput(true, 'Array');
    this.setTooltip(function() {
      var mode = thisBlock.getFieldValue('MODE');
      if (mode == 'SPLIT') {
        return Blockly.Msg.LISTS_SPLIT_TOOLTIP_SPLIT;
      } else if (mode == 'JOIN') {
        return Blockly.Msg.LISTS_SPLIT_TOOLTIP_JOIN;
      }
      throw 'Unknown mode: ' + mode;
    });
  }
function ( ) { // Assign 'this' to a variable for use in the closures below. var thisBlock = this ; var dropdown = new Blockly . FieldDropdown ( [ [ Blockly . Msg . LISTS_SPLIT_LIST_FROM_TEXT , 'SPLIT' ] , [ Blockly . Msg . LISTS_SPLIT_TEXT_FROM_LIST , 'JOIN' ] ] , function ( newMode ) { thisBlock . updateType_ ( newMode ) ; } ) ; this . setHelpUrl ( Blockly . Msg . LISTS_SPLIT_HELPURL ) ; this . setColour ( Blockly . Blocks . lists . HUE ) ; this . appendValueInput ( 'INPUT' ) . setCheck ( 'String' ) . appendField ( dropdown , 'MODE' ) ; this . appendValueInput ( 'DELIM' ) . setCheck ( 'String' ) . appendField ( Blockly . Msg . LISTS_SPLIT_WITH_DELIMITER ) ; this . setInputsInline ( true ) ; this . setOutput ( true , 'Array' ) ; this . setTooltip ( function ( ) { var mode = thisBlock . getFieldValue ( 'MODE' ) ; if ( mode == 'SPLIT' ) { return Blockly . Msg . LISTS_SPLIT_TOOLTIP_SPLIT ; } else if ( mode == 'JOIN' ) { return Blockly . Msg . LISTS_SPLIT_TOOLTIP_JOIN ; } throw 'Unknown mode: ' + mode ; } ) ; }
Block for splitting text into a list, or joining a list into text.
@this Blockly.Block
Block for splitting text into a list or joining a list into text .