Thursday, May 27, 2021

OIC - Javascript - find name and value parameters from a string

 function returnParameter(value,splitString,indexString,type,count){

var output=value.split(splitString)

var index=output[count].indexOf(indexString);

if(type=='Name'){

var parameter=output[count].substring(0,index);

}

else{

var parameter=output[count].substring(index+1);

}

result=parameter

return result

}

Input:

(abc;a=b,";","=","Name",$loopCountString)

(abc;a=b,";","=","Value",$loopCountString)

output:

Name=a

value=b

here loopCountOfString = the count of ";" the string contains.

No comments:

Post a Comment

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...