字符串分割和放大器;搜索VB.NET [英] String Split & Search VB.NET

查看:123
本文介绍了字符串分割和放大器;搜索VB.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要采取串在VB和分裂它。还需要查看一下这两个返回的值并返回其中包含domain1.com的价值。管道是分隔符。

  txtEmailFrom.Text =john@huno.com | james@domain1.com
DIM brokened()作为字符串
brokened =分割(txtEmailFrom.Text,|)
 

不知道在哪里可以从这里...

解决方案

  txtEmailFrom.Text =john@huno.com | james@domain1.com
DIM brokened()作为字符串
昏暗的电子邮件作为字符串
昏暗emailSplit()作为字符串
brokened =分割(txtEmailFrom.Text,|)

电子邮件在brokened
   emailSplit =斯普利特(电子邮件,|)
   如果emailSplit(1)=domain1.com再
      Console.WriteLine(电子邮件)
   如果结束
下一个
 

我写这没有IDE&放大器;这可能是VB6的风格。
我们希望,它应该给转换为VB.net你的想法

编辑:Ofcourse,这将是更好的这行之前添加检查数组边界如果emailSplit(1)= ...

Need to take a string in vb and split it. Also need to look through the two returned values and return the value which contains "domain1.com". Pipelines are the delimiter.

txtEmailFrom.Text = "john@huno.com|james@domain1.com"
Dim brokened() As String
brokened = Split(txtEmailFrom.Text, "|")

Dont know where to go from here...

解决方案

txtEmailFrom.Text = "john@huno.com|james@domain1.com"
Dim brokened() As String
dim email as string
dim emailSplit() as string
brokened = Split(txtEmailFrom.Text, "|")

for email in brokened
   emailSplit = Split(email, "|")
   if emailSplit(1) = "domain1.com" then
      Console.WriteLine(email)
   end if
next

I am writing this without IDE & this could be VB6 style.
Hopefully, it should give you an idea of converting to VB.net

EDIT: Ofcourse, it will be better to add checks for array bounds before this line if emailSplit(1) = ....

这篇关于字符串分割和放大器;搜索VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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