找回密码
 加入
搜索
查看: 5309|回复: 5

[系统综合] 如何输出半角人民币符号?

  [复制链接]
发表于 2013-1-29 15:21:53 | 显示全部楼层 |阅读模式
测试无论使用何种半角人民币符号,在输出时都会转为全角单横人民币符号。
求解如何正确输出半角人民币符。
发表于 2013-1-29 16:43:07 | 显示全部楼层
不知道你说的是那种字符?能先上个图吗?
发表于 2013-1-29 22:31:06 | 显示全部楼层
本帖最后由 netegg 于 2013-1-29 22:32 编辑

Chr(165)。。。。。、哦,不对,单横
发表于 2013-1-29 22:59:38 | 显示全部楼层
回复 1# piku


    看你这个发帖,特地查看了下银行票据和税务票据
都是用半角双横线的那个,而没有用全角单横线的那个


$iNum1 = AscW("¥")
$iNum2 = AscW("¥")
MsgBox(0, 1, $iNum1)
MsgBox(0, 2, $iNum2)



若你实在要你的要求,就对输入的字符象上一样查嘛,每当发现$iNum2的值为165,就设置为65509
发表于 2013-1-30 08:16:06 | 显示全部楼层
这个符号啊,如下:
$a = ChrW(65509)
ConsoleWrite($a)
MsgBox(0, 1, $a)
;~ ==============================
Dim $b = BinaryToString("0xa3a4")
ConsoleWrite($b)
MsgBox(0, 2, $b)
;~ ==============================
#include <Array.au3>
Dim $c[1] = [65509]
Dim $d = StringFromASCIIArray($c)
ConsoleWrite($d)
MsgBox(0, 3, $d)
发表于 2013-1-30 08:40:42 | 显示全部楼层
本帖最后由 netegg 于 2013-1-30 08:45 编辑

[au3]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[0]) Then
        Return SetError(1, 0, '')
    EndIf
    Return $Ret[5]
EndFunc   ;==>_WinAPI_GetCurrencyFormat[/au3]
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-3 06:20 , Processed in 0.092405 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表