-2
A
回答
1
假设你的号码是lnMyNumber:
lnMyNumber = 3521
? (Val(Left(Str(lnMyNumber, 4, 0),2)) > Val(right(Str(lnMyNumber, 4, 0),2)))
0
命令窗口例如:
LOCAL unknownType
unknownType = 3521
? CompareSumsOfTwoBytePairs(unknownType) && returns true
unknownType = "3521"
? CompareSumsOfTwoBytePairs(unknownType) && returns true
unknownType = "YZAB"
? CompareSumsOfTwoBytePairs(unknownType) && returns true
unknownType = 35210
? CompareSumsOfTwoBytePairs(unknownType) && too long, returns false
* The following unexpected types return all false:
unknownType = .F.
? CompareSumsOfTwoBytePairs(unknownType)
unknownType = .Null.
? CompareSumsOfTwoBytePairs(unknownType)
unknownType = CREATEOBJECT("Form")
? CompareSumsOfTwoBytePairs(unknownType)
unknownType = DATE(2015, 2, 7)
? CompareSumsOfTwoBytePairs(unknownType)
FUNCTION CompareSumsOfTwoBytePairs(u)
LOCAL c
c = TRANSFORM(u)
RETURN LEN(c) == 4 AND (SUBSTR(c, 1, 2) > SUBSTR(c, 3, 2))
ENDFUNC
0
另一种选择是保留号码为数字VS被迫字符串转换。
n = 3521
? INT(n/100) > n-(INT(n/100)*100)
n/100 = 35.21... the int leaves just 35
,这同样依据是另一半......
n-(INT(n/100)*100)
3521 - (INT(3521/100) * 100)
= 3521 - ( 35 * 100)
= 3521 - 3500 = 21
so 35 > 21
0
这是一个完整的代码比你可以把一个函数
local lnVal, llReturn
lnVal=35821
llReturn=left(trans(lnVal),2)>right(trans(lnVal),2)
return llReturn
+2
虽然此代码段可能会解决问题,但[包括解释](http://meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers)确实有助于提高帖子的质量。请记住,您将来会为读者回答问题,而这些人可能不知道您的代码建议的原因。 – Bono 2015-03-16 12:56:00
相关问题
- 1. Visual Fox Pro和Python
- 2. visual fox pro recno()函数
- 3. 使用Visual Fox Pro OleDb
- 4. Visual fox Pro 9.地址组合框用法
- 5. 串联在Visual Fox Pro 6.0中
- 6. 使用activex创建Visual Fox Pro DBF
- 7. 如何从mysql获取utf-8字符到visual fox pro
- 8. Fox Pro导出例程
- 9. 如何从Visual Fox Pro保持mysql连接活着
- 10. fox pro查询返回连续行号
- 11. 在Microsoft SQL中添加Visual Fox Pro数据库作为链接服务器
- 12. 从.NET Visual Fox Pro驱动程序在DBF文件中插入浮点值
- 13. Fox Pro停止工作和OLE错误代码0x800a004c
- 14. 将9位数字转换为3位3位数字
- 15. 4位数字的计算
- 16. Visual Build Pro 9无法构建使用PrivateObject的单元测试
- 17. 评估字符串“1 + 2^4 * 4 *(4 + 4 * 9)-10”
- 18. Visual Studio 2010 Pro - SuppressMessage
- 19. 如何生成一个9位数字
- 20. Visual FoxPro 9动态数组
- 21. Visual Studio Pro 2015:错误DEP6100
- 22. Visual Studio代码片段 - 使用9以上的数字作为占位符?
- 23. 提取4位数字 - 错误信息
- 24. Zend_Date:将2位数字的年份值扩展为4位数字年份
- 25. javascript函数只接受4位数字
- 26. PHP数字格式4个位数
- 27. MPI FOX算法
- 28. pdfgrep'\ d {3} - \ d {2} - \ d {4}'vs'[0-9] {3} [ - ]?[0-9] {2} [ - ]?[0- 9] {4}”
- 29. 从字符串中提取9位数字
- 30. NSNumberFormatter只允许4位数字
所以我需要一个像3+ 5 2 + 1是好的,因为8> 3 这个任何命令? – 2015-02-06 10:23:03