def gen_float_list_string(vals, mesg='', nchar=0, left=False):
    """mesg is printed first, if nchar>0, it is min char width"""
    istr = mesg
    if left:
        format = '%-'
    else:
        format = '%'
    if nchar > 0:
        format += '*g '
        for val in vals:
            istr += format % (nchar, val)
    else:
        format += 'g '
        for val in vals:
            istr += format % val
    return istr
