Skip to content

Replace value with = does not get correctly replaced #1

@misoares

Description

@misoares

I noticed that if the replacement value contains the = character the value is not correctly replaced

Bellow is a fix for it that uses substring instead of split. If you don't mind, can you apply this patch?

  var result = "In first grade I learned that operationResult"
  var vars = "operationResult=1+1=2".replace(' ', '').split(',')
  for(var i = 0; i < vars.length; i++)
  {
    var firstEqual = vars[i].indexOf('=');
    var key = vars[i].substr(0,firstEqual);
    var value = vars[i].substr(firstEqual+1);
    result = result.replace(key, value)
  }
  console.log(result)
  //"In first grade I learned that 1+1=2"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions