NotesScript 进制转换

来源:互联网 发布:数据库路由器软件icx 编辑:程序博客网 时间:2024/04/29 15:33

Function Convert(pIInput As Integer, pIBase As Integer)
 Dim ttemp As Integer
 Dim ttemp2 As Integer
 Dim tValue As String
 tValue = ""
 ttemp = pIInput
 While ttemp <> 0
  If Cint(ttemp/pIBase) - ttemp/pIBase > 0 Then
   ttemp2 = Cint(ttemp/pIBase) - 1
  Else
   ttemp2 = Cint(ttemp/pIBase)
  End If
  
  tValue =  Trim(Str(ttemp - ttemp2*pIBase)) & tValue
  ttemp = ttemp2
 Wend
 Convert = tValue
End Function

调用: 取得十六进制Convert(inputdata, 16)  ( 10-> A, 11-> B, 12-> C, 13->D, 14->E, 15->F)

原创粉丝点击