I wrote one JavaScript/jQuery plugin to one of my client. In that, generating serial numbers with adding string at middle is one of the concept. Concept was, want to place the custom string value at positions but remaining values should aligned serial. For Example: serial Values is “1,2,3,4,5,6”, want to place a string “D” at 2 positions 3 & 2. So finally result should be, 1,D,2,D,3,4.
How to achieve this?
Here is the quick JavaScript code which i got on stack-overflow site. It was done using JavaScript.
var deletearray = SplitString_ToArray(deletedString);
deletearray.sort(sortfunction);
deletedString = deletearray.toString();
var Values = "1,2,3,4,5,6";
var allValues = Values.split(','),
length = allValues.length;
deletedString.split(',').forEach(function(position) {
allValues.splice(parseInt(position) - 1, 0, 'D');
});
var newValues = allValues.splice(0, length).join();
alert(newValues);
function sortfunction(a, b){
return (a - b) //causes an array to be sorted numerically and ascending
}
function SplitString_ToArray(inString){
var result = inString.split(',');
console.log(result);
return result;
}
It is appropriate time to make some plans for the future and it’s time to be happy.
I’ve read this post and if I could I want to suggest you few interesting things or advice.
Maybe you could write next articles referring to this article.
I wish to read more things about it!
I like what you guys are up too. This kind of clever work and reporting!
Keep up the superb works guys I’ve incorporated you guys to my own blogroll.
Very quickly this site will be famous amid all blog users, due to it’s nice articles
Very soon this web page will be famous among all blogging and site-building people, due to it’s good
content
Sixty two HER 2 positive patients received trastuzumab based therapy at the time of progression lasix alternative