I have the following string comparison that is throwing an error I
cannot find ( I will include my attempts to trace the error)
In the line following the asterisks, written as I have below, a true is
always returned and the printed msg appears that the 2 variables are
not equal. This happens even when the print statement writes out,
"Change Doc Types TASK and TASK are not equal". (So, even when I test
each variable separately and it evaluates to "TASK", I still get a true
on the first condition telling me that "TASK" and "TASK" are not
equal).
If I test by setting either variable to the thing I am testing for
(e.g., "TASK") the first test evaluates to false and the else statement
is executed (this is the expected result).
If I change the condition to read
if (vTODChgDocName == "TASK" && vMSBChgDocName != "TASK") the first
condition evaluates to false, and the else executes.
The "error" only occurs when I am testing vTODChgDocName against
vMSBChgDocName.
CODE:
for (var vTODChgDocIterator = vTODChgDocCollection.iterator();
vTODChgDocIterator.hasNext(); )
{
var vTODChgDocPointer = vTODChgDocIterator.next()
vTODChgDoc = vTODChgDocCollection.get(vTODChgDocPointer)
var vTODChgDocName = vTODChgDoc.name
var vMSBChgDocName = childType.name
print ("vTODChgDoc.name = " + vTODChgDocName + " , vMSBChgDocName = " +
vMSBChgDocName)
// ******* error is occuring in the following line ********************
if (vTODChgDocName != vMSBChgDocName)
{
print ("Change Doc Types " + vTODChgDocName + " and " + vMSBChgDocName
+ " are not equal\n")
}
else
{
print ("Found " + vTODChgDocName + " in TOD")
vTODChgDocFound = 1 }
}