<-- Previous || Up || Next -->

Write Code Block Function
String Extras Class

Public Function WriteCodeBlock( _
      ByVal vTemplate As Variant _
    , ByVal vKeywords As Variant _
    ) As Variant

Creates a block of text by substituting each of a series of alphanumeric keywords into a "template."

Examples:
    ? WriteCodeBlock("Print \% \\ 40 ' \Div.", "XPos")
    Print XPos \ 40 ' Div.
    ? WriteCodeBlock("Dim \% As Integer\n", "XPos YPos")
    Dim XPos As Integer
    Dim YPos As Integer
    ? WriteCodeBlock("Property Get \%() As Integer\n   \% = g\%\nEnd Property\n\n", ClipboardToString)
See also:
    ReplaceString Function, et. al.
    StringReplacements Class
vTemplate: String containing the "template" or "boilerplate" text which is to be repeated for each keyword in vKeywords. Function returns Null if vTemplate is Null or cannot be fixed up to a String.
Note: Within the template string, certain character sequences have special meanings:
    \n   Replaced by carriage return and new line characters.
    \\   Replaced by a single slash character.
    \%   Replaced by the current keyword.
Any other pair of characters which begins with a slash will have the slash character removed.

vKeywords: String containing the alphanumeric keywords which are each to be substituted into the "template" as the appropriate place. Function returns Null if vKeywords is Null or cannot be fixed up to a String.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.