在空行尾计算制表符

时间:2016-11-23 11:00:37

标签: java split count

我不知道我的问题是否有意义,但我正面临这个问题

案例1:

For i = 1 to n
  strDate = workbooks.worksheet("Sheet1").cells(i,1)
  emailList = workbooks.worksheet("Sheet1").cells(i,2)
  if (strDate=expectedDate) then
     call sendMail(emailList)
  end if
Next


Public function sendMail(emailList)

Dim OutApp As Object
Dim OutMail As Object

With Application
    .ScreenUpdating = False
    .EnableEvents = False
End With


 On Error GoTo err


'Now open a new mail

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = emailList
.CC = ""
.Subject = "test"
.Body = "the content of the mail"
End With
On Error GoTo 0


'set nothing to the objects created
Set OutMail = Nothing
Set OutApp = Nothing

'Now set the application properties back to true
With Application
    .ScreenUpdating = True
    .EnableEvents = True
End With
MsgBox ("Email has been Sent Successfully")
Exit Sub
err:
    MsgBox err.Description
End function

案例2:

String fileLine  ="->->->6";
System.out.println(fileLine.split("\t").length);

output: 4

问题案例:

String fileLine  ="1->->->6";
System.out.println(fileLine.split("\t").length);

output: 4

任何人都可以告诉我为什么会这样,并抓住这种情况?

即使文件结尾为空,我也希望捕获行尾的标签

由于

0 个答案:

没有答案