A Replace function question...

In Xojo IDE for Windows I set

Dim txtFileName as string = Session.Login + “" + Session.myPatientName + "” + d.ShortDate +".txt"

When compiled, in Windows Chrome gives
xxx_patient_4_15_2018.txt

In Chrome Mac, gives
xxx_patient_4/15/2018.txt which produces an error

In order to fix, it I add
txtFileName = Replace(txtFileName, “/”, “_”)

And gives
xxx_patient_4_15/2018 which produces an error,too

It seems a kind of an Xojo internal bug? or what…?

You still have a forward slash (which is the file delimiter on Mac). Use ReplaceAll instead.

Instead of relying on d.shortdate, which can be set by the user to pretty much anything, you should format that string yourself.

Please try when you post code to select it and click the Code icon above the editor like I do below. It is a courtesy to other forum members to offer more legibility.

Something like this should do :

Dim txtFileName as string = Session.Login + "_" + Session.myPatientName + "_" + str(d.month)+"_"+str(d.day)+"_"+str(d.year)+".txt"

as it’s for a file name, maybe the mdy format is not important and simply use

Dim txtFileName as string = Session.Login + "_" + Session.myPatientName + "_" + d.SQLDate + ".txt"

Equally, if you needs to stick to your format, you could change Replace() function to ReplaceAll().

I had already solved then problem thinking as Michael.
Appreciate you all, for your nice alternatives!