Created
October 28, 2011 21:16
-
-
Save hpcorona/1323588 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROCEDURE TemplateBuild(LOCAL sTemplate is string, Variables is assosiative array of strings) | |
sOpenBrace is string = "${" | |
sCloseBrace is string = "}" | |
sNewStr is string = "" | |
nUPos is int = 1 | |
nPos is int | |
nPos = Position(sTemplate,sOpenBrace) | |
nFin is int | |
WHILE nPos >= 1 | |
sNewStr += sTemplate[[nUPos TO nPos - 1]] | |
nFin = Position(sTemplate,sCloseBrace,nPos) | |
sNewStr += Variables[sTemplate[[nPos + Length(sOpenBrace) TO nFin - 1]]] | |
nUPos = nFin + Length(sCloseBrace) | |
nPos = Position(sTemplate,sOpenBrace,nUPos) | |
END | |
sNewStr += sTemplate[[nUPos TO]] | |
RESULT sNewStr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment