0

i have column having multiple value like A0045 ,A00065 . i want to convert it 9945, 9965. Need to remove all 0 and character value and add 99 before that value.. replace(val,"A","99") will replace only A I want to go for A-Z occurrence.. Any char should be convert .. Please help

Tom Bascom
  • 13,405
  • 2
  • 27
  • 33
user3668036
  • 25
  • 1
  • 11

2 Answers2

0

How about

newValue = "99" + LEFT-TRIM( oldValue, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0" ).

This should take all leading alpha and zero characters from the string, and prefix with 99.

Screwtape
  • 1,337
  • 2
  • 12
  • 27
0
/************Try this*********************/

define variable word as character no-undo.

define variable i as integer no-undo.

assign word = "A00065".

/******to remove all the zeroes**************/

word = replace(word,substring(word,index(word,"0"),(r-index(word,"0") - 1)),"").

do i = 65 to 90:

   if substring(word,1,1) = chr(i) then 
   do:

      word = replace(word,substring(word,1,1),"99").
      leave.
   end. 


end. 

display word.
Vega
  • 27,856
  • 27
  • 95
  • 103