m程序设计 字符函数 宏替换函数:&<字符型变量>【<字符串常量>] 宏替换函数&替换字符型变量的值,注意在&后的变量必须是字符型。 常用在程序中实现对任意的输入对象进行相关操作。 用将宏替换函数后的字符串常量分隔。 【例】 执行下列命令后,将显示 store 100 to yz store 10 to y store 'z to n store y&n to m ?&m A.100 B.0 C.10 D显示‘变量没找到 FoxproForWindowshttp://cc.synu.edu.cn 6
FoxPro For Windows http://cc.synu.edu.cn 6 FoxPro程序设计 宏替换函数:&<字符型变量>[.<字符串常量>] 宏替换函数&替换字符型变量的值,注意在&后的变量必须是字符型。 常用在程序中实现对任意的输入对象进行相关操作。 用.将宏替换函数后的字符串常量分隔。 【例】 执行下列命令后,将显示: store 100 to yz store 10 to y store 'z' to n store 'y&n' to m ? &m A.100 B.0 C.10 D.显示‘变量没找到’ 字符函数
m程序设计 【例】km= space(8) @5,15say"请输入数据库文件名:" get km read use &km 【例】允许&嵌套 stor 99 to rj 8899 stor ""toz & j stor r&z to mn & &mn 8&99 【例】宏函数与后面字符间,以"."分隔 stor /"to c &/ stor 125&c 5 to s 8&1255 【例】X=1998 ?&X+5 882003 ?&X+5 8&1998+5 FoxproForWindowshttp://cc.synu.edu.cn 7
FoxPro For Windows http://cc.synu.edu.cn 7 FoxPro程序设计 【例】 km=space(8) @ 5,15 say "请输入数据库文件名:" get km read use &km 【例】允许&嵌套 stor 99 to rj &&99 stor "j" to z && j stor "r&z" to mn && rj ? &mn && 99 【例】宏函数与后面字符间,以"."分隔 stor "/" to c && / stor "125&c.5" to s && 125/5 【例】 X=‘1998’ ? &X+5 &&2003 ? ‘&X+5’ && 1998+5