我将如何创建一个将字符串拆分为不同电子邮件的循环? [英] How would I create a loop which splits up a string into different emails?

查看:16
本文介绍了我将如何创建一个将字符串拆分为不同电子邮件的循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是不言自明的.我想使用 ; 将抄送分成电子邮件.作为指标.我目前的代码如下:

It is pretty self explanatory. I would like to split Cc into emails using the ; as an indicator.The code I have at the moment is as follows:

Dim sEmailAddress As String



                Dim iPos As Integer
                iPos = InStr(Me.Cc, ";") ' Looks in the first parameter for the second parameter and returns the position of the first occurance of the second parameter. If there is no occurrance of the second parameter then 0 will be returned
                ' 
                Dim iLen As Integer
                iLen = Len(Me.Cc) ' iLen will = then length of me.CC - for example if me.cc = "Hello World", iLen = 11

                '
                Dim sPart As String
                sPart = Left(Me.Cc, 10) ' Returns the first 10 characters from Me.CC - for example if Me.CC = "Hello World", sPart = "Hello Wor"
                '
                Dim sPart2 As String
                sPart2 = Right(Me.Cc, 4) ' Returns the right most 4 characters from Me.CC, for example if me.CC = "Hello World", sPart2 = "orld"
                '
                Dim sPart3 As String
                sPart3 = Mid(Me.Cc, 6, 2) ' Returns 2 characters starting at position 6 from Me.CC, for example if me.cc = "Hello World", sPart3 = " W"

                Do While 


                    ' get email address
                    oNetworxEmail.AddToAddress(sEmailAddress)
                Loop
                If  Then
                    ' get email address
                    oNetworxEmail.AddToAddress(sEmailAddress)
                End If

推荐答案

如果你想那样做,那会很头疼.String.split 是一种更好的方法.

Thats a big headache if you wanna do it that way. String.split is a much better way.

Dim splitArray() As String = String.Split(Me.Cc, ";")

这篇关于我将如何创建一个将字符串拆分为不同电子邮件的循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆