-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0981d0c
commit d7700c4
Showing
2 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
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
22 changes: 22 additions & 0 deletions
22
src/com/as3mxml/asconfigc/utils/populateHTMLTemplateFile.as
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.as3mxml.asconfigc.utils | ||
{ | ||
public function populateHTMLTemplateFile(content:String, options:Object):String | ||
{ | ||
if(options === null) | ||
{ | ||
return content; | ||
} | ||
for(var key:String in options) | ||
{ | ||
var token:String = "${" + key + "}"; | ||
var value:String = options[key]; | ||
var index:int = content.indexOf(token); | ||
while(index !== -1) | ||
{ | ||
content = content.substr(0, index) + value + content.substr(index + token.length); | ||
index = content.indexOf(token); | ||
} | ||
} | ||
return content; | ||
} | ||
} |