Hello,<br><br>I have been looking at the following code, but struggle a bit to understand how this loop is working in IMPL_LINK_NOARG(ComboBox, ImplSelectHdl) :<br> xub_StrLen nIndex = 0;<br> while ( nIndex != STRING_NOTFOUND )<br>
{<br> xub_StrLen nPrevIndex = nIndex;<br> XubString aToken = aText.GetToken( 0, mcMultiSep, nIndex );<br> xub_StrLen nTokenLen = aToken.Len();<br> aToken = comphelper::string::strip(aToken, ' ');<br>
sal_uInt16 nP = mpImplLB->GetEntryList()->FindEntry( aToken );<br> if ( (nP != LISTBOX_ENTRY_NOTFOUND) && (!mpImplLB->GetEntryList()->IsEntryPosSelected( nP )) )<br>
{<br> aText.Erase( nPrevIndex, nTokenLen );<br> nIndex = sal::static_int_cast<xub_StrLen>(nIndex - nTokenLen);<br> if ( (nPrevIndex < aText.Len()) && (aText.GetChar( nPrevIndex ) == mcMultiSep) )<br>
{<br> aText.Erase( nPrevIndex, 1 );<br> nIndex--;<br> }<br> }<br> aText = comphelper::string::strip(aText, ' ');<br>
}<br><br>My problem lies with how the nIndex variable gets updated, I don't see how it can reach STRING_NOTFOUND any other way than by luck. I must be missing something.<br>Does anybody have a better read than me here?<br>
<br>BTW I am trying to convert this code to use OUString, so any suggestion in this direction is more than welcome :)<br><br>Cheers,<br>Jean--Noël<br>