在Visual Basic中使用split [英] usage of split in visual basic

查看:92
本文介绍了在Visual Basic中使用split的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在分析代码,其中将双精度值更改为字符串,然后将其拆分并存储到数据库中.


例如:dim a为double = 123.23
将b()变暗为字符串
b = a.tosting().split(.")

可以这样aslo

将a变暗为double = 123.23
将dim b作为字符串
b = a.tostring()

任何人都可以帮助我找到在这种情况下split()的用途.

i have been analysing a code in that a double value is being changed to string and is split and then stored into database.


ex:dim a as double=123.23
dim b() as string
b=a.tosting().split(".")

this can be done like this aslo
i.e
dim a as double=123.23
dim b as string
b=a.tostring()

can anyone plz help me find what is the use of split() in this case.

推荐答案



参见此示例:
Hi,

see this sample:
Dim a As Double = 123.23
Dim b As String() = Nothing
b = a.ToString().Split("."C)
Dim part1 As String = b(0)
Dim part2 As String = b(1)
MessageBox.Show(part1 + "  " + part2)


基本上在这种情况下,split将句点之前和之后的部分分开,以便在b(0)中具有"123",在b(1)中具有"23".请注意区域设置,其中123.23可能显示为123,23(例如,德国就是这种情况).


Basically in this case, split separates the part before and after the period, so that in b(0) you have "123" and in b(1) you have "23". Please take care of regional settings where 123.23 may be displayed as 123,23 (e.g. this is the case in Germany).


这篇关于在Visual Basic中使用split的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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