Skip to main content

Inputbox string - remove special characters

Hi Brian,

I'm back again :-)

I'm running a script and I would like user to be able to enter a case reference which is stored as a string.

Much later in the script this will be used to create an output filename.

The following lines allow me to get the input, tidy it a little, and then pass it to create the filename.

caseref = InputBox("Enter your case reference", "Case Reference", " ", 815,475)

caseref = UCase(LTrim(Left(caseref, 20)))

dbName = pfolder &"\Calculations for" +caseref +".IMD"

All of this works without any problem.

However, it is dependent on the user not entering any of the special characters that are not allowed to be used in a filename.

I'm wondering is there something I can use here that is similar to the IDEA @Strip function?

Any advice would be much appreciated.

All the best,

Phil

Brian Element Thu, 08/08/2024 - 05:42

Hi Phil, yes that should work.  I tried it out and it seems to be getting what you are looking for.  You need to replace the @ with an i in order to use the function in IDEAScript.

Sub Main

caseref = InputBox("Enter your case reference", "Case Reference", " ", 215,475)

caseref = UCase(LTrim(Left(caseref, 20)))

caseref = iStrip(caseref)

dbName = pfolder &"\Calculations for" +caseref +".IMD"

End Sub