RenameMapElement()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

RenameMapElement()

Post by Little John »

Hi,

would it make sense to have a built-in function like the following?

Code: Select all

Macro RenameMapElement (_map_, _oldKey_, _newKey_)
   ; in: _map_: without trailing '()'
   
   If FindMapElement(_map_(), _newKey_) = #Null
      _map_(_newKey_) = _map_(_oldKey_)
      DeleteMapElement(_map_(), _oldKey_)
   EndIf
EndMacro
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: RenameMapElement()

Post by Josh »

Could make sense, but the pointer to the data area should not change.
sorry for my bad english
User avatar
mk-soft
Always Here
Always Here
Posts: 6209
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: RenameMapElement()

Post by mk-soft »

This will probably not happen, as maps are stored in slots.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply