cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
HBindu
Level 3

StrPutTokens() not returning null delimited string in IS2011

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)
Labels (1)
0 Kudos
(1) Reply
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

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 != 0) then
displayString = testString;
j = j + 1;
else
displayString = displayString + "";
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?
0 Kudos