### Map Replace Key

Replace a map key with its value in a line.
' Example `
' ' Private Sub to be replaced with `Private Sub
' Dim m As Map = CreateMap("Private Sub":$"`Private Sub"$)
' Dim Line As String = "Private Sub TEST"
' Line = MapReplaceKey(m, Line)
'`
`Sub Map_ReplaceKey(m As Map, Line As String) As String 'ignore
' Loop over the mapkeys to find if the line starts with the key (NOTE: not the map value)
For Each key As String In m.Keys
' The line starts with the key, lets replace the key with the value
If Line.StartsWith(key) Then
' Replace the line
Line = Line.Replace(key, m.Get(key))
Exit
End If
Next
Return Line
End Sub`
``

Changed: 2018-05-24 10:15, Category: Map, File: T6C217M2177.htm, ID: 2177