Page 1 of 1

Trimming a string - rather than a character

Posted: Thu Jan 31, 2008 12:54 pm
by sjordery
Hi All,

Probably a simple one for you gurus out there, but it's been a long day here...

Basically, I have the following row:
<OpenTag attritbute"888"><SecondOpenTag>
As part of my processing, I am splitting up the XML and don't want the second open tag...

So, what I want to do is:

Code: Select all

Trim(Input.Field,'<SecondOpenTag>','A')
But of course, this is no good as trim only does a single char. Any easy way to do this...? I wanted to avoid server job/routine and don't know C++.

Many thanks in advance.
S

Posted: Thu Jan 31, 2008 1:20 pm
by DSguru2B
If server job is acceptable, use EREPLACE() to replace the string.

Posted: Thu Jan 31, 2008 1:37 pm
by crouse
Is there only one occurence of "<SecondOpenTab>" in the string?

if so, you could do SOMETHING like:
right(string,index(string,"<SecondOpenTab>",1) -1) : left(len(string) - index(string,"<SecondOpenTab>",1) + 15)

In essence, you clip off the right and left side and concat them together.

If you have more than one occurance to remove... you'll need to do this over and over. ick!

Posted: Fri Feb 01, 2008 10:00 am
by sjordery
Great - thanks very much for ther pointers. :)

Cheers,
S