?CHR(INT(VAL([0X99])))
?DECTOHEX(31)
?DECTOHEX(ASC([红]))
?DECTOHEX(ASC(SUBS([红],1,1))) + DECTOHEX(ASC(SUBS([红],2,1)))
*--------------------------------------------------------------------------------
*十进制转十六进制函数
*--------------------------------------------------------------------------------
FUNCTION DECTOHE...
示例
如:\u6cb3\u5357\u7701
Clear
? Strconv(Chr(0x6cb3%256) + Chr(Int(0x6cb3/256)), 6) + ;
Strconv(Chr(0x5357%256) + Chr(Int(0x5357/256)), 6) + ;
Strconv(Chr(0x7701%256) + Chr(Int(0x7701/256)), 6)
结果:河南省
文本框 LostFocus 事件代码
NoDefault
Rreturn
日期型:{}
日期时间型:{/:}
ld=DATE(2015,2,29)
IF EMPTY(ld)
?"非闰年"
ELSE
?"闰年"
ENDIF
此处的年龄指的是周岁
SFZHM="333333201501261111"
?INT((VAL(DTOS(DATE()))-VAL(SUBSTR(SFZHM,7,8)))/10000)
CLEAR
n=5
RS=121
NOTE S型算法
?"S型算法"
lcstr=""
FOR I=1 TO RS
lni=IIF(MOD(I,2*n)>n,n-MOD(I,n)+1,(IIF(MOD(I,2*n)=0,1,MOD(I,2*n))))
lcstr=lcstr+str(lni,2)
ENDFOR
?lcstr
NOTE 错位算法
?"错位算法"
lcstr=""
FOR I=1 TO RS
lni=MOD(INT((i-1)/n)+MOD(i-1,n),n)+1
lcstr=lcstr+str(lni,2...
1.在类库MyVcx中建立一个工具栏类MyToolBar,将工具栏的ShowWindow属性设置为1——最上层表单;
2.给顶层表单添加一个自定义属性TopToolBar;
3.编辑顶层表单的Activate event,输入以下代码:
This.TopToolBar=NewObject("MyToolBar","MyVcx")
This.TopToolBar.show()
This.TopToolBar.dock(0)
现在,你就可以享受顶层表单的工具栏了!
create cursor tt (a1 i,a2 i,a3 i,a4 i,a5 i,a6 i,a7 i,a8 i,a9 i,a10 i,a11 i)
rand(-1)
for lnI=1 to 11
append blank
nzds=0
for lnJ=(lnI-1)*11+1 to lnI*11
nzds=nzds+1
replace (field(nzds)) with lnJ*rand()
endfor
endfor
lcStru=""
for lnI=1 to fcount()
...
CREATE CURSOR 数据表 (选择 L, 区号 c(10), 城市 c(10) )
INSERT INTO 数据表 VALUES (.T.,'021','上海')
INSERT INTO 数据表 VALUES (.F.,'010','北京')
INSERT INTO 数据表 VALUES (.T.,'020','广州')
GO TOP
BROWSE NAME GrdCur NOWAIT
GrdCur.column1.width = 50
GrdCur.column2.width = 100
GrdCur.column3.width = 100
GrdCur....
a=1234.567800
a=alltrim(padl(a,20," ")) &&VFP中数值型数据有效长度不会超过20位
? "整数位数:",len(JUSTSTEM(a))
? "小数位数:",len(JUSTEXT(a))
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
DoCreate = .T.
Caption = "Form1"
Name = "Form1"
ADD OBJECT text1 AS textbox WITH ;
Height = 20, ;
Left = 72, ;
Top = 36, ;
Width = 100, ;
...
* 测试表
CREATE CURSOR T (BH C(4),B1 N(4),B2 N(4),B3 N(4),B4 N(4))
INSERT INTO T VALUES ([0001],1200,1000,800,600)
INSERT INTO T VALUES ([0002],1100,900,700,500)
INSERT INTO T VALUES ([0003],1900,1700,1500,1300)
SELECT *,000000 小计 FROM T INTO CURSOR TEMP READWRITE
LCSTR=[]
* 生成字段名列表
FOR I=...
clear
for i=1 to 100
k=0
cstr=""
for j=1 to i-1
if i % j=0
k=k+j
cstr = cstr+alltrim(str(j))+","
endif
endfor
if k=i
?str(i) +" 完数 :" +left(cstr,len(cstr)-1)
endif
endfor
oSpeech = CreateObject("SAPI.SpVoice") &&连接到系统的语音功能
sWord='中华人民共和国'&&被阅读的字串
oSpeech.Speak(sWord) &&让系统读出字符串里的内容
oSpeech=NULL &&阅读完毕
clear
input "输入行数:" to n
dime a(n,n)
for i=1 to n
?space((n-i)/2*5)
for j=1 to i
if j=1 or i=j
a(i,j)=1
else
a(i,j)=a(i-1,j-1)+a(i-1,j)
endif
??str(a(i,j),5)
endfor
?
endfor
clear
cstr="abc32skfkj262ksf8k99kfsk24kf"
cstr1=""
ncount=0
nsum=0
ok=.f.
for i=1 to len(cstr)
a=substr(cstr,i,1)
if isdigit(a)=.t.
cstr1=cstr1+a
ok=.t.
else
if ok=.t.
nsum=nsum+val(cstr1)
cstr1=""
ok=.f.
...
DECLARE INTEGER GdipLoadImageFromFile IN Gdiplus.dll STRING, INTEGER @
DECLARE INTEGER GdipSaveImageToFile IN Gdiplus.dll INTEGER, STRING, STRING, INTEGER
DECLARE INTEGER GdipDisposeImage IN Gdiplus.dll INTEGER
lcBMPFile = GETPICT("BMP")
lcJPGFile = FORCEEXT(lcBMPFile,"JPG")
lnImage =0
=G...
CLEAR
cStr="第一百零七章 好事多磨"
=ALINES(Astr,cStr,"第","章")
nLen=0
cLstr=""
cRstr=""
cStr1=astr[2]
* 左取两个字符
IF LEFT(cStr1,2)="十" AND LEN(cStr1)>2
cLstr="1"
cStr1=cLstr+SUBSTR(astr[2],3)
ENDIF
* 右取两个字符
DO CASE
CASE RIGHT(cStr1,2)="十" AND LEN(cStr1)=2
cRstr="10"
...