获取字符串之间的子字符串 [英] Get Substring between a string

查看:89
本文介绍了获取字符串之间的子字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

唐1-2011

问题是我必须通过子字符串函数捕获don-和-2011之间的增量值,该值将逐条记录增加记录,可以是1,10,111,1000,10001,请在这方面帮助我.

在此先感谢

Hi all

Don-1-2011

The problem is that i have to capture incrementing value between don- and -2011 through substring function, this value will increase record by record that can be 1,10,111,1000, 10001, please help me in this regard.

thanks in advance

推荐答案

最简单的方法是使用String.Split将字符串分为三部分:
The easiest way is to use String.Split to chop the string into three parts:
Dim input As String = "Don-1234-2011"
Dim parts As String() = input.Split("-"C)
Dim justTheMiddle As String = parts(1)


Dim parts() as String
Dim don = "don-10001-2011"
Dim result as String
parts = don.Split("-")
result = parts(1) 'incase of zero based array else 2 for 1 based array indices



希望对您有所帮助!

-MRB



Hope that helps!

-MRB


path=path.Substring(3, path.Length - 7);(

3对应于don,-7 if(3 + 4)4对应于2011)

3 corresponds to don and -7 if(3+4) 4 corresponds to 2011)


这篇关于获取字符串之间的子字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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