Spliting Formula using JQuery -
i have generated formulas , stored in database.now,when want use formulas,i select 1 formula autocomplete list example :
abc=((bbc*40%)/cbc)+52
now ,i want split formula , fetch bbc,cbc values database , calculate answer.how can split formula , separate out operators , operands using jquery?
i succeed in splitting formula following way,
var expression = "((bbc*40%)/cbc)+52".replace(/[^a-z]+/gi, "#").replace(/[\.]/g, ""); var operators = expression.split("#").filter(function(n){ return n }); for(var = 0; < operators.length; i++){ console.log("operator"+i+" :"+operators[i]); }
may helpful someone...
Comments
Post a Comment