foxpro中的年月日怎么转换成大写?
foxpro中的的年月日怎么批量转换成大写?大写年份、月份和日期分别生成一个字段。跪谢!!!!
参考答案:将年份、月份、日期分别转换成单个的数字字符,再转换成相应的大写,再合成。
将下列程序存为xxtodx.prg
调用时xxtodx(express)
PARAMETERS rq
SET date to ymd
SET MARK to "-"
yearsz=YEAR(rq)
yearc=STR(yearsz,4)
yearc1=SUBSTR(yearc,1,1)
yearc2=SUBSTR(yearc,2,1)
yearc3=SUBSTR(yearc,3,1)
yearc4=SUBSTR(yearc,4,1)
monthsz=MONTH(rq)
monthc=STR(monthsz,2)
monthc1=SUBSTR(monthc,1,1)
monthc2=SUBSTR(monthc,2,1)
daysz=DAY(rq)
dayc=STR(daysz,2)
dayc1=SUBSTR(dayc,1,1)
dayc2=SUBSTR(dayc,2,1)
yearzf=szzh(yearc1)+szzh(yearc2)+szzh(yearc3)+szzh(yearc4)
DO case
case monthsz<10
monthzf=szzh(monthc2)
CASE monthsz=10
monthzf="十"
CASE monthsz>10
monthzf="十"+szzh(monthc2)
ENDCASE
DO case
case daysz<10
dayzf=szzh(dayc2)
CASE daysz=10
dayzf="十"
CASE daysz>10.and.daysz<20
dayzf="十"+szzh(dayc2)
CASE daysz=20 .or.daysz=30
dayzf=szzh(dayc1)+"十"
CASE daysz>20
dayzf=szzh(dayc1)+"十"+szzh(dayc2)
ENDCASE
RETURN yearzf+"年"+monthzf+"月"+dayzf+"日"
PROCEDURE szzh (szzf)
DO case
CASE szzf="0"
RETURN "○"
CASE szzf="1"
RETURN "一"
CASE szzf="2"
RETURN "二"
CASE szzf="3"
RETURN "三"
CASE szzf="4"
RETURN "四"
CASE szzf="5"
RETURN "五"
CASE szzf="6"
RETURN "六"
CASE szzf="7"
RETURN "七"
CASE szzf="8"
RETURN "八"
CASE szzf="9"
RETURN "九"
ENDCASE