Re: VBScript dictionary delete by index ?

"Mr. Man-wai Chang" <[email protected]> Thu, 6 Nov 2025 22:12:31 +0800
Newsgroups alt.comp.lang.vbscript,alt.comp.os.windows-xp,alt.windows7.general
Organization https://sites.google.com/site/changmw/
Message-ID <[email protected]>
On 6/11/2025 10:03 pm, R.Wieser wrote:
 >
 > I've got a vbscript Dictionary object, and need to be able to delete a
 > key-item pair by its index.  Can it be done and if so, how is
 > it expressed ?
 >
 > Remark: I can use
 >
 > oDict.remove oDict.keys()(Index)
 >
> Just now I realized that I took it for granted that I can't "for each" a
> dictionary in a reverse order (the reason for the reverse order is because I
> want to delete items)
> 
> So, I'm asking now : is it possible to do a "for each key in oDict" from the
> last to first item ?
> 
> I just googeled for it and didn't find anything, but that doesn't say
> everything.
> 


If you can use array index to access oDict, you first count the number 
of items in oDict, then use a for loop from number of items back to 1.

-- 
   @~@   Simplicity is Beauty! Remain silent! Drink, Blink, Stretch!
  / v \  May the Force and farces be with you! Live long and prosper!!
/( _ )\ https://sites.google.com/site/changmw/
   ^ ^   https://github.com/changmw/changmw