ok I want do have a jscript below
$(document).ready(function(){
var str = 'post'; //the subject string
var arr =[0,2]; //to uppercase character index 0 and 2
str = str.split("");
for(var i = 0; i < str.length; i++){
if($.inArray(i,arr)){
str[i] = str[i].toUpperCase();
}
}
str = str.join('');
alert(str);
//the result must be PoSt
});
and you may see it running here
http://jsfiddle.net/laupkram/WfUUp/
now what I want there is to provide a subject string and an array.
the subject string is the string to be process and the array contains numerical values that will represent the character index in the string to uppercase.
did i miss something with my script that’s why I get undersirable results?
Check the docs for $.inArray . It returns the index of the element that was found or
-1if not found.