如何将A0058值转换为9958正在进行中4gl

时间:2017-10-25 10:01:18

标签: openedge progress-4gl 4gl

我的列有多个值,如A0045,A00065。我想将其转换为9945,9965。需要删除所有0和字符值并在该值之前添加99 .. 替换(val,“A”,“99”)将只替换A我想去A-Z发生..任何char应该转换..请帮助

2 个答案:

答案 0 :(得分:0)

怎么样

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

这应该从字符串中获取所有前导字母和零字符,并使用99前缀。

答案 1 :(得分: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.