PDA

View Full Version : StrPutTokens() not returning null delimited string in IS2011



HBindu
09-03-2010, 01:39 AM
Using StrPutTokens() to create a string with null seperator. This used to work fine in IS2010, we have recently upgraded to IS2011 and StrPutTokens() is failing. The list has 7 items and StrPutTokens() is returning only the first item. Following is my code. Is this a bug in 2011?

if (StrGetTokens (listItem, svData, ";") < 0) then
// Report the error.
endif;

svData = "";
StrPutTokens( listItem, svData, "", TRUE)

joshstechnij
09-03-2010, 03:14 PM
I haven't been able to reproduce any issues with StrPutTokens with a null delimited string. Here is some test code I tried:


function OnBegin()
LIST listStrings;
STRING testString, originalString, displayString;
NUMBER i, j, size1;
begin
testString = "one;two;three;four";
originalString = testString;

listStrings = ListCreate(STRINGLIST);

StrGetTokens(listStrings, testString, ";");
testString = "";
StrPutTokens(listStrings, testString, "", TRUE);

ListDestroy(listStrings);

size1 = SizeOf(testString);
i = 0;
j = 0;
while(i < size1)
if(testString[i] != 0) then
displayString[j] = testString[i];
j = j + 1;
else
displayString = displayString + "<null>";
j = j + 6;
endif;

i = i + 1;
endwhile;

MessageBox("Original: " + originalString + "\nNew: " + displayString, 0);
end;


This produces the output shown in the attached screenshot. Notice that all the strings are delimited with nulls in the final output.

What are you testing that indicates StrPutTokens is not working?