Replace '|' with TAB in text string

Hi

I’ve been searching the forums for the best part of two hours trying to find the answer to this:

How do I replace every occurrence of a | with the TAB character (ASCII Character 09, unless I’m mistaken)?

The reason for this is that whenever I try to get data from FileMaker with a TAB in the text it is omitted, so I need to use a | character and then replace it with the script I’m using already - unless someone knows another way.

Your help with this is very much appreciated!

Steve :slight_smile:

set StuffFromFilemaker to "This|and|that"

set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to "|"
set StuffFromFilemaker to StuffFromFilemaker's text items
set AppleScript's text item delimiters to tab
set StuffFromFilemaker to StuffFromFilemaker as string
set AppleScript's text item delimiters to astid
StuffFromFilemaker

I think this is still limited to a maximum of about 4000 instances of the character to be replaced in any one string.

Thank you Nigel, I’ll be giving this code you’ve submitted a go in a little over an hour! :slight_smile:

Absolutely perfect Nigel - thank you so much!! :smiley: