Page 1 of 1

Trimming new line character

Posted: Tue Feb 19, 2008 6:59 am
by MOHAMMAD.ISSAQ
My project has JPN-SJIS character set.I'm reading a .csv file.When i view the data for the last columns have one unusual character at the end.
When i pasted it in text editor i found it as new line.

I want to trim this "new line" character, and my columns has variable length.

How can i do this?
Please help me out..

Posted: Tue Feb 19, 2008 7:19 am
by chulett
Assuming 'new line' = LF:

Code: Select all

Convert(CHAR(10),"",YourField)
Or

Code: Select all

EReplace(YourField,CHAR(10),"")

Posted: Tue Feb 19, 2008 8:47 am
by MOHAMMAD.ISSAQ
Thanks Chulett for the help.
But still i'm not clear. Can you be more specific..
What's that LF,code and char(10) ?

I think i didn't given the clear picture.It's given below

My columns last character has newline('\n') but it appeared as some unusual character, since i've JPN-SJIS character set.And moreover my columns are not fixed width.

I think this will be more clear..

Posted: Tue Feb 19, 2008 9:20 am
by chulett
Not sure how much more clear I can be. LF = 'Line Feed' = hex a = decimal 10 = 'new line'. If that's what your character is, then what was posted should work. If it isn't, then you'll need to post something more specific than it being 'some unusual character'.

Read the online help for the CHAR() function if you don't know what it does.

Posted: Tue Feb 19, 2008 10:03 am
by MOHAMMAD.ISSAQ
Thanks a lot..
I've used that code but still same character is coming.
Since the 'new line' character is coming at the end.
I trimmed like this "Col_Name[1,Len(Col_Name)-1]"

It's working now..

Anyhow thanks again for the help..

Posted: Tue Feb 19, 2008 10:20 am
by chulett
Well, then it's not a new line. If you get the actual decimal value, then you can do as I suggested. However, if it is always just the last character in the field, then your substring is perfectly valid as well.