Special case of strip

9 posts / 0 new
Last post
avikerem's picture
avikerem
Offline
Joined: 04/07/2015 - 00:28
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's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

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's picture
avikerem
Offline
Joined: 04/07/2015 - 00:28

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's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

So I guess you could have an equation like this: 

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

avikerem's picture
avikerem
Offline
Joined: 04/07/2015 - 00:28

Exactly!  LOL

NancyMcR
Offline
Joined: 10/08/2014 - 15:52

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

avikerem's picture
avikerem
Offline
Joined: 04/07/2015 - 00:28

??
You must be joking, right?

KrisW
Offline
Joined: 02/16/2015 - 13:38

@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's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

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