Skip to main content

Special case of strip

Hi Brian, how are you?
I have a problem. I want to remove the character " from a field. I do not wisht o use @strip because it removes all special characters. I could not find a function that will accept " as the character to handle (replace, remove, etc. - they all failed)
Thans!
Avi

Brian Element Sun, 03/06/2016 - 07:37

Hi Avi,

I am doing well, how are you doing these days.

Actually there is a trick to do this.  You have to replace the # with @chr(34) which is the same as #.  So if you use the replace you would need something like this:  @replace(MY_FIELD, @chr(34), " ") if you want to replace the # with a space.

Brian

avikerem Sun, 03/06/2016 - 10:45

I actually use char(34) a lot... The problemwas I tried chr(34) in the script formula and you actually need @chr(34)..
 
THANKS A LOT as usual for yopur excellent solution and quick response.

Brian Element Sun, 03/06/2016 - 12:41

So I guess you could have an equation like this: 

field.Equation = "@Replace(FIELD1, @chr(34), " & chr(34) & "a" & chr(34) & ")"

NancyMcR Thu, 03/10/2016 - 16:29

Try using just a single quote between the double quotes with @Remove.  Equation is @Remove(FIELDNAME, "'")  Your character " is really just 2 ' together.

KrisW Mon, 09/12/2016 - 13:10

@Replace(FIELD_NAME, @chr(10)," ") to remove line feeds from ASCII IDEA works just great. Does anyone have a method that will work with UNICODE?
@chr() is not an available function. @Strip() is not an option as it will remore ALL spaces & punctuation in addition to the "\n". I can use @RegExp(FIELD_NAME,"\n") to identify problem fields/records, but I get stuck after that.

Brian Element Mon, 09/12/2016 - 13:54

In reply to by KrisW

Off the top of my head you might need the Unicode version of IDEA.  Per the IDEAScript help:

Note: The IDEA ASCII version that you currently have installed will only read ASCII files, not Unicode files.

Or you need to find a text editor and do the find / replace outside of IDEA and then perform the import.  Notepad reads unicode text files, when I have had a problem previously I opened it in notepad and then resaved it as an ANSI file and that fixed my unicode problem.  If you are working with a database this probably won't help you out.

Brian