-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