如何输出半角人民币符号?
测试无论使用何种半角人民币符号,在输出时都会转为全角单横人民币符号。求解如何正确输出半角人民币符。 不知道你说的是那种字符?能先上个图吗? 本帖最后由 netegg 于 2013-1-29 22:32 编辑
Chr(165)。。。。。、哦,不对,单横 回复 1# piku
看你这个发帖,特地查看了下银行票据和税务票据
都是用半角双横线的那个,而没有用全角单横线的那个
$iNum1 = AscW("¥")
$iNum2 = AscW("¥")
MsgBox(0, 1, $iNum1)
MsgBox(0, 2, $iNum2)
若你实在要你的要求,就对输入的字符象上一样查嘛,每当发现$iNum2的值为165,就设置为65509 这个符号啊,如下:
$a = ChrW(65509)
ConsoleWrite($a)
MsgBox(0, 1, $a)
;~ ==============================
Dim $b = BinaryToString("0xa3a4")
ConsoleWrite($b)
MsgBox(0, 2, $b)
;~ ==============================
#include <Array.au3>
Dim $c =
Dim $d = StringFromASCIIArray($c)
ConsoleWrite($d)
MsgBox(0, 3, $d)
本帖最后由 netegg 于 2013-1-30 08:45 编辑
Global Const $tagNUMBERFMT = 'uint NumDigits;uint LeadingZero;uint Grouping;ptr DecimalSep;ptr ThousandSep;uint NegativeOrder;'
Global Const $tagCURRENCYFMT = $tagNUMBERFMT & 'uint PositiveOrder;ptr CurrencySymbol;'
Local $Number = -123456.569
Local $Number1 = 123456.569
MsgBox(0,0,_WinAPI_GetCurrencyFormat(0, $Number)&@crlf&_WinAPI_GetCurrencyFormat(0, $Number1))
Func _WinAPI_CreateCurrencyFormatInfo($iNumDigits, $iLeadingZero, $iGrouping, $sDecimalSep, $sThousandSep, $iNegativeOrder, $iPositiveOrder, $sCurrencySymbol)
Local $tFMT = DllStructCreate($tagCURRENCYFMT & 'wchar[' & (StringLen($sDecimalSep) + 1) & '];wchar[' & (StringLen($sThousandSep) + 1) & '];wchar[' & (StringLen($sCurrencySymbol) + 1) & ']')
DllStructSetData($tFMT, 1, $iNumDigits)
DllStructSetData($tFMT, 2, $iLeadingZero)
DllStructSetData($tFMT, 3, $iGrouping)
DllStructSetData($tFMT, 4, DllStructGetPtr($tFMT, 9))
DllStructSetData($tFMT, 5, DllStructGetPtr($tFMT, 10))
DllStructSetData($tFMT, 6, $iNegativeOrder)
DllStructSetData($tFMT, 7, $iPositiveOrder)
DllStructSetData($tFMT, 8, DllStructGetPtr($tFMT, 11))
DllStructSetData($tFMT, 9, $sDecimalSep)
DllStructSetData($tFMT, 10, $sThousandSep)
DllStructSetData($tFMT, 11, $sCurrencySymbol)
Return $tFMT
EndFunc ;==>_WinAPI_CreateCurrencyFormatInfo
Func _WinAPI_GetCurrencyFormat($LCID, $sNumber, $tCURRENCYFMT = 0)
If Not $LCID Then
$LCID = 0x0400
EndIf
Local $Ret = DllCall('kernel32.dll', 'int', 'GetCurrencyFormatW', 'ulong', $LCID, 'dword', 0, 'wstr', $sNumber, 'ptr', DllStructGetPtr($tCURRENCYFMT), 'wstr', '', 'int', 2048)
If (@error) Or (Not $Ret) Then
Return SetError(1, 0, '')
EndIf
Return $Ret
EndFunc ;==>_WinAPI_GetCurrencyFormat
页:
[1]