In PowerShell, I have a structure (HashTable type) created like so:
$Structure = @{
"KeyOne" = "Value"
"KeyTwo" = "{Change.This.That}"
"KeyThree" = "{Change.This.Thing} With Stuff"
"Change" = @{
"This" = @{
"That" = "Another Value"
"Thing" = "Yogurt"
}
}
}
The string with the curly brackets are placeholders/tokens for what the actual value should really be, stored in a string format as a reference to the dot notation of some other value within the same object.
I wrote a function to take that tokenized value and retrieve what the actual value is supposed to be that works perfectly fine. Only problem is I have to execute the function every time there is a tokenized value. Is there anyway I can simplify this, specifically instead of running:
#I pass structure because I'd rather avoid assuming
#the hashtable will always be called $Structure
Convert-Token -String $Structure.KeyTwo -Obj $Structure #Another Value
is there anyway I can automatically do this by just pulling the bracket notation?
#Like this?
$Value = $Structure["KeyThree"]
$Value #Yogurt With Stuff
Possible? Not possible?