返回正确的匹配字符串 [英] To return the correct matching string

查看:66
本文介绍了返回正确的匹配字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用流读取器读取文件,并且这样做时我逐行读取文件,并且得到如下行

Hi
I am reading a file using stream reader and when doing so i read the file line by line and i get the line as follows

BH01803502625DUNCAN JOHNNY 03092010M362340313


现在,当我用Johnny搜索它时,我必须得到另外两个字符串


now when I search it with Johnny i have to get other two strings

BH01803502625DUNCAN and 03092010M362340313 


请帮助实现此目标

谢谢
Abinav Shankar


pl help in doing it

thanks
Abinav Shankar

推荐答案

非常简单.如果您了解一些基本的String函数,则可以轻松实现.请检查此代码:
It''s very simple.If you know some basic String Functions you can do it easily.Check this code :
Dim s As String = "BH01803502625DUNCAN JOHNNY 03092010M362340313"
'It this is your String
MessageBox.Show(s.Substring(0, s.IndexOf(" ")) & " and " & s.Substring(s.LastIndexOf(" ") + 1))


希望它能解决您的问题. :)


I hope it will solve your problem. :)


这篇关于返回正确的匹配字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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