高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】oddbtextiterator with zero-length string
oddbtextiterator with zero-length string
oddbtextiterator with zero-length string
hello-
it appears to me that if an oddbtextiterator is initialized with a string of zero length, then the current properties field is not initialized correctly. this structure includes a field, blastchar, that can be used to determine if the iterator is at the end of the string. this field is not set upon initialization, and so testing it, then calling nextchar() when blastchar is false, will attempt to read a character (though nextchar() returns 0 and then sets blastchar).
shouldn't this field be set upon initialization of the oddbtextiterator? is there something else i am missing? is there a better way to test if an iterator is at its end that is initialized immediately?
thanks,
mike ryan
hello,
you are right. the current properties are valid after call nextchar(). it is as design.
quote:
is there a better way to test if an iterator is at its end that is initialized immediately?
you can avoid using textiterator for empty string via test odstring.isempty() befor init it.
best regards,
sergey z.
|