Page 1 of 1

Adding a Character in the transformation

Posted: Thu Aug 23, 2007 9:27 am
by srinivenigalla
I get a value in Char "00000012" but i need to replace the first character of the value with 'A'.
What is the best way of doing it.

Re: Adding a Character in the transformation

Posted: Thu Aug 23, 2007 9:33 am
by gateleys
srinivenigalla wrote:I get a value in Char "00000012" but i need to replace the first character of the value with 'A'.
What is the best way of doing it.

1. Is the length always the same?
2. Is the first character always 0?

Posted: Thu Aug 23, 2007 10:24 am
by srinivenigalla
Irespective of the size and the value of the character in first posiition, How can we proceed

Posted: Thu Aug 23, 2007 10:56 am
by chulett
Substring off the "2nd thru len()" characters and concatenate your new value onto the front it that.

Posted: Thu Aug 23, 2007 11:16 am
by gateleys
One of the ways -

Code: Select all

'A':RIGHT[InputString, Len(InputString) - 1]

Posted: Thu Aug 23, 2007 11:21 am
by gateleys
Another way -

Code: Select all

Ereplace(InputString, InputString[1,1], 'A', 1, 1)

Posted: Thu Aug 23, 2007 11:49 am
by srinivenigalla
I tried the Ereplace function it is returning Value'A' but i want is A001, if the original value is 0001

Posted: Thu Aug 23, 2007 1:17 pm
by gateleys
srinivenigalla wrote:I tried the Ereplace function it is returning Value'A' but i want is A001, if the original value is 0001
I just tried it, and the input '0001' does return 'A001' with the Ereplace function I provided. Please check that you have used it correctly, that is, as I have specified above. You may have skipped the last 2 arguments.