Rich Text Formatting

Hi, I’m creating a Rich Text Formatter but I’m unsure on how to properly manipulate this string.

What I want to accomplish:
I want to wrap the rich text bold identifier around two indexes in the string.

Heres my code so far:

function Format(text, paramTable)
    --// Incase we were not supplied the paramTable, use this one.
    local default = {
        bold = {1,#text} 
    -- The table we give are indexes of
    -- where we want the <b> identifier to be located.
    -- In this case its 1, #text (string length)
    -- This will bold the entire text.
    -- If we supplied "bold = {4, 5}"
    -- The bold would only be from index 4, 5 (two characters).
    -- The main thing I'm unsure about, is how to make room
    -- in the string for the <b>{TEXT HERE}</b>

    if(paramTable.bold) then 
        text = -- What do I do here?