How to add quotes at begin and end of a text field

How to add quotes at begin and end of a text field

  
I need to write a number of fields to a file. Most of these fields are text. In some cases the fields are automatically quoted (e.g. "abcde"), in some cases not (e.g. 12345). However, they must always be quoted, also if the field only contains digits. How can I do this?
Annemarie -

The following expressions may help you out (pick what works for you). The last one will add quotes if not the first character is not a quote:

valueToWrite = """ + value + """

- or -

valueToWrite = chr(34) + value + chr(34)

- or -

if(substr(value,0,1)=chr(34), value,"""+value+""")

Good luck...

Ken