Home > m2html > @template > private > subst.m

subst

PURPOSE ^

TEMPLATE/SUBST Substitute a replacement field by its value

SYNOPSIS ^

function [tpl, str] = subst(tpl,handle)

DESCRIPTION ^

TEMPLATE/SUBST Substitute a replacement field by its value
  STR = SUBST(TPL,HANDLE) substitute all the known fields of variable HANDLE
  in the template TPL.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [tpl, str] = subst(tpl,handle)
0002 %TEMPLATE/SUBST Substitute a replacement field by its value
0003 %  STR = SUBST(TPL,HANDLE) substitute all the known fields of variable HANDLE
0004 %  in the template TPL.
0005 
0006 %  Copyright (C) 2003 Guillaume Flandin <Guillaume@artefact.tk>
0007 %  $Revision: 1.0 $Date: 2003/05/05 22:19:51 $
0008 
0009 tpl = loadtpl(tpl,handle);
0010 
0011 str = get(tpl,'var',handle);
0012 for i=1:length(tpl.varkeys)
0013     str = strrep(str, strcat('{',tpl.varkeys{i},'}'), tpl.varvals{i});
0014 end

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005