分解特殊字符:“123456789012345678-80/95”
时 间:2017-08-03 14:56:22
作 者:易勋 ID:35404 城市:上海
摘 要:分解特殊字符:“123456789012345678-80/95”
123456789012345678
123456789012345679
123456789012345680
123456789012345695
正 文:
函数:
Public Function SplitInCo(strChar As String) As String Dim strInvoiceNumber As String Dim strInvoiceCode As String Dim intS As Integer Dim intLen As Integer Dim inti As Integer Dim strInv As String Dim strTemp As String Dim strType As String Dim arrInvoice() As String Dim intArr As Integer Dim strInvoice As String Dim lngInv As Long Dim strFormat As String intLen = Len(strChar) Select Case intLen Case Is < 18 SplitInCo = "" Case Is = 18 If Not strChar Like "*-*" And Not strChar Like "/" Then SplitInCo = strChar strInvoiceCode = Left(strChar, 10) strInvoiceNumber = Right(strChar, 8) Else SplitInCo = "" End If Case 19 SplitInCo = "" Case Is > 19 If Mid(strChar, 19, 1) = "-" or Mid(strChar, 19, 1) = "/" Then strInvoice = Left(strChar, 18) intArr = 0 inti = 0 strType = Mid(strChar, 19, 1) For intS = 20 To intLen strTemp = Mid(strChar, intS, 1) strInv = strInv & strTemp If strTemp = "-" or strTemp = "/" or intS = intLen Then If intS <> intLen Then strInv = Left(strInv, Len(strInv) - 1) End If Select Case strType Case "-" For inti = 1 To Len(strInv) strFormat = strFormat & "0" Next If Val(Right(Split(strInvoice, "|")(intArr), Len(strInv))) < Val(strInv) Then For lngInv = Val(Right(Split(strInvoice, "|")(intArr), Len(strInv))) + 1 To Val(strInv) strInvoice = strInvoice & "|" & Left((Split(strInvoice, "|")(intArr)), 18 - Len(strInv)) & Format(lngInv, strFormat) intArr = intArr + 1 Next End If strFormat = "" Case "/" If Len(strInv) <= 8 Then strInvoice = strInvoice & "|" & Left((Split(strInvoice, "|")(intArr)), 18 - Len(strInv)) & strInv intArr = intArr + 1 Else strInvoice = strInvoice & "|" & strInv intArr = intArr + 1 End If ' Case Else ' strInvoice = strInvoice & "|Error" End Select strInv = "" strType = strTemp End If Next SplitInCo = intArr + 1 SplitInCo = strInvoice Else SplitInCo = "" End If End Select End Function
用法:
SplitInCo("123456789012345678-80/95")
Access软件网官方交流QQ群 (群号:54525238) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- 统计当月之前(不含当月)的记录...(03.11)
- 【Access Inputbo...(03.03)
- 按回车键后光标移动到下一条记录...(02.12)
- 【Access Dsum示例】...(02.07)
- Access对子窗体的数据进行...(02.05)
- 【Access高效办公】上月累...(01.09)
- 【Access高效办公】上月累...(01.06)
- 【Access Inputbo...(12.23)
- 【Access Dsum示例】...(12.16)

学习心得
最新文章
- 仓库管理实战课程(9)-开发往来单...(04.02)
- 仓库管理实战课程(8)-商品信息功...(04.01)
- 仓库管理实战课程(7)-链接表(03.31)
- 仓库管理实战课程(6)-创建查询(03.29)
- 仓库管理实战课程(5)-字段属性(03.27)
- 设备装配出入库管理系统;基于Acc...(03.24)
- 仓库管理实战课程(4)-建表操作(03.22)
- 仓库管理实战课程(3)-需求设计说...(03.19)
- 仓库管理实战课程(2)-软件背景和...(03.18)
- 仓库管理实战课程(1)-讲师介绍(03.16)