Skip to content

Instantly share code, notes, and snippets.

@jbratu
Created February 20, 2020 00:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbratu/bab2085cec81f9bf954dc7b9596b57b4 to your computer and use it in GitHub Desktop.
Save jbratu/bab2085cec81f9bf954dc7b9596b57b4 to your computer and use it in GitHub Desktop.
Function CS_SIMPLE_KEY_VALUE(Action, Array, Key, Value)
If Action _EQC 'set' Then
Swap @FM With @VM In Value
ArrayCount = DCOUNT(Array,@FM)
For i = 1 To ArrayCount
If Array<i,1> = Key Then
Array<i> = Key : @VM : Value
Return ''
End
Next i
Array<ArrayCount + 1> = Key : @VM : Value
Return ''
End
If Action _EQC 'get' Then
ArrayCount = DCOUNT(Array,@FM)
For i = 1 To ArrayCount
If Array<i,1> = Key Then
Entry = Array<i>
Entry = Entry[Len(Key)+2,Len(Entry)]
Swap @VM With @FM In Entry
Return Entry
End
Next i
Return ''
End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment