If you can create a list of the characters to remove, you can use the Convert function documented
here
if you scroll down a bit. Convert them all to "" to simply remove them. If you'd rather build a list of the characters to
keep
then do an
exact search
here for "double convert", a useful technique based on what to keep rather than what you want to remove.

_________________-craig

Pinky's as perfect as the Fourth of July, quilted and timeless, seldom denied

Well, crap... just dawned on me I missed the "leading and trailing" part of this. Seems to me you may just need to substring out the middle... use
Index
to find the first and last "non-special" character in the string and cut that chunk out of the middle.

I'm also curious if "^" is a single character or if it takes on the meaning of "control" here? Meaning is "^&" one character or two characters? I'm assuming two but thought it prudent to confirm.

_________________-craig

Pinky's as perfect as the Fourth of July, quilted and timeless, seldom denied

If that reply was directed my way, I didn't ask anything about a delimiter... but it looks like you answered my question indirectly. And that's not how one would use Index for this, you ask it to look for that
specific string of 52 characters,
not any single one of them. Having said that, I don't think my suggestion of using that function was exactly spot on so I'll have to ponder this a bit today to see what else comes to mind.

_________________-craig

Pinky's as perfect as the Fourth of July, quilted and timeless, seldom denied

No srini this is not delimeter &^.We don't have any delimeter in the input source. As i mentioned in the example that we will have input data like and we don't know the input data.we need to remove the special characters from leading and trailing.we are not removing any special characters in between alphabet characters.

Looks like it's converting only the First CHAR(82) (R to 1) and ignoring all others

Tried as convert('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz','1','!@##$$Rami^&Reddy*&^%$')
but this is also resulting as !@##$$^&*&^%$
in this case, it just drops all Alphabets from the String

You need to look at the description of the function again. It takes all characters in the "from" list and replaces each
with the corresponding (positional) character
in the "to" list. In other words, to replace them all with a "1" you would need the same number of "1"s in the second list.

Was just coming here to say that in all honesty I'm thinking that your best option here is to write something in C++ and that I'm a bit surprised that UCDI hasn't already come along and said something along those lines.

_________________-craig

Pinky's as perfect as the Fourth of July, quilted and timeless, seldom denied

You have a logical paradox in your requirements: certain characters are to be removed, except when they are not to be removed. The difference is positional, which is why it's a paradox.

Why must you preserve the characters on the inside? Is this a hard requirement (like an audit trail), or is it arbitrary?

I suggest you move up a step, and identify the purpose of the data. In your example, you have a person's name. If the data is a name, there should be no reason to preserve the characters between the first and last name. You should be able to just identify all invalid characters, replace them with Space(), do a final Trim to remove leading and trailing and reduce the internal spaces to one.

It looks to me like you have bad, messy data (usually because users are lazy), and you are being told to clean it up by the users who don't know how to properly construct a requirement. You may not have any control over the users, but sometimes they just have to be told "no, you can't have it this way."

but if it turns out that you need some awful convoluted logic to do this, write a C or basic routine. Trying to drop a 15+ deep nested replace with if-thens in the middle is going to be unpossible to debug and even if you get it working it will be extra challenging to upgrade or modify it later.

Add To FavoritesView next topicView previous topic
You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forum