将字符串拆分为数组。 [英] Split a string into an array.

查看:159
本文介绍了将字符串拆分为数组。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个字符串作为示例L2 022(忽略双引号)。如何拆分一串空间?因此,如果我拆分成arrStr(1)的数组,则值为:



arrStr(0)= L2

arrStr( 1)= 022



我没有在数据库上放置分隔符。我怎么能这样做?

解决方案

我建​​议你从这里开始:



微软MSDN - Sting.Split [ ^ ]



这应该为您提供拆分字符串所需的所有信息。


尝试:

  Dim  str  As   String  =   L2 022 
Dim arrStr() As String = str.Split(


 < span class =code-keywo rd> Dim  str  as   String  =    L2 022 
Dim arrStr()作为 字符串 = str.Split( [ Char ](){ c})





参见 String.Split方法(Char()) [ ^ ]。


Hi all,

I have a string as example "L2 022" (ignore the double quote). How to split a string of space? So if I split into and array of arrStr(1), the value will be:

arrStr(0) = L2
arrStr(1) = 022

I don't put a delimiter on database. How can I do this?

解决方案

I suggest you start here:

Microsoft MSDN - Sting.Split[^]

This should give you all the information you need to split a string.


Try:

Dim str As String = "L2 022"
Dim arrStr() As String = str.Split(" ")


Dim str as String = "L2 022"
Dim arrStr() As String = str.Split(New [Char]() {" "c})



See String.Split Method (Char())[^].


这篇关于将字符串拆分为数组。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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