将字符串拆分为数组。

编程入门 行业动态 更新时间:2024-10-13 04:21:14
本文介绍了将字符串拆分为数组。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我有一个字符串作为示例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( )

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())[^].

更多推荐

将字符串拆分为数组。

本文发布于:2023-11-29 22:29:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1647809.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数组   字符串

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!