坚持139

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

如何查找指定字符在字符串中位置,又一个例子:

假定StrSuperUser = "chaney.ho@advantech.com.tw;julia.wong.advantech.com.tw",通过StrSuperUser.IndexOf(chaney.ho@advantech.com.tw),返回0,StrSuperUser.Remove(int startIndex,int count), startIndex 为开始删除字符的位置。count 为要删除的字符数。

假定StrSuperUser="chaney.ho@advantech.com.tw", StrSuperUser.Remove(0,count),返回为""。

 

                        Dim loc As Integer = StrSuperUser.IndexOf("Chaney.Ho@advantech.com.tw", StringComparison.OrdinalIgnoreCase)
                        Dim count As Integer = "Chaney.Ho@advantech.com.tw".Length()
                        If StrSuperUser.Length > count Then count = count + 1 'if more than 1 email, remove ;
                        StrSuperUser = StrSuperUser.Remove(loc, count)

 

posted on 2011-12-12 16:56  坚持139  阅读(416)  评论(0编辑  收藏  举报