I am trying to compare string data taken off a Persistant Vector, with an if statement. However, the comparison is not working, it always evaluates to false in the if. The code is below with the comment, //trying to compare strings
export function removeStudent(rmstudidx: i32): string{
let ablist = new Array<string>();
let rmstudent: string = "";
let abstudent: string = "";
let abindx = new Array<i32>();
let absentidx: i32;
let x: i32 = 0;
abstudent = studentlist[rmstudidx];
if(studentlist.containsIndex(rmstudidx)){
rmstudent = studentlist.swap_remove(rmstudidx);
//return "Removed " + rmstudent;
}
while (x < absentlist.length){
abstudent = studentlist[rmstudidx];
if(rmstudent === abstudent){ //trying to compare strings
return "In the string test"
absentlist.swap_remove(x);
x++;
}
}
return "Removed " + rmstudent;
}