how to replace part of part of string in javascript -
i have 2 guids. looking replace c013d94e
1st guid cd11d94e
of second guid in javascipt
.
i checked javascript replace()
method not sure how can use specific case.
c013d94e-3210-e511-82ec-303a64efb676
- 1st guid
cd11d94e-3210-e511-82ec-303a64efb676
- 2nd guid
following code trying
for(var i=0; < response[1].length;i++) angular.foreach($scope.studentpermissions[i][0].children, function (subject) { string 1stguid= response[1].data[i].id; // contains cd11d94e-3210-e511-82ec-303a64efb676 subject.id = // contains c013d94e-3210-e511-82ec-303a64efb676 });
@jamen. yes other part of 1st string same. how can use concatenate?
you don't need use replace then? make brand new string:
var guid = "cd11d94e-3210-e511-82ec-303a64efb676";
but, answer question in title:
var input = "c013d94e-3210-e511-82ec-303a64efb676"; var output = input.replace("c013d94e", "cd11d94e"); console.log(output); // cd11d94e-3210-e511-82ec-303a64efb676
but said, in situation shouldn't necessary, based on quote.
Comments
Post a Comment