Page 1 of 1

Modify the 1st digit

Posted: Wed Aug 18, 2010 3:51 am
by arnie_nits
Hi, I have requirement where if the record are 1,15,201...then the output should be 1,15,501....that is if the number is 3 digit then the 1st digit needs to be changed to 5.

Please suggest....

Thanks...

Posted: Wed Aug 18, 2010 3:58 am
by ArndW
Is this 3 different columns or one string of value "1,15,201"? or 3 different values for one column?

Assuming the latter, "IF LEN(In.Col)=3 THEN '5':In.Col[2,2] ELSE In.Col"

Posted: Wed Aug 18, 2010 4:01 am
by Sainath.Srinivasan
Something like

Code: Select all

svYourNumLen = len(yourNum)
If svYourNumLen >= 3 Then yourNum[1,svYourNumLen-3] : '5' : yourNum[yourNumLen - 2, 2] Else yourNum