如何获得两个其他字符之间的字符? [英] How can I get the characters between 2 other characters?

查看:28
本文介绍了如何获得两个其他字符之间的字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个字符串,它在某些时候包含以下格式的字符集[123].

I have a string which at some point contains the set of characters in the following format [123].

我想要做的是获取 [] 之间的字符,但它们之间的字符长度永远不会相同.

What I would like to do is get the characters between [] but the characters in between are never the same length.

我将如何在 VB.NET 中处理这个问题?

How would I go about this in VB.NET?

推荐答案

Dim s As String = "foo [123]=ro bar"
Dim i As Integer = s.IndexOf("[")
Dim f As String = s.Substring(i + 1, s.IndexOf("]", i + 1) - i - 1)

这篇关于如何获得两个其他字符之间的字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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