web 2.0

VB.NET & Split()

VB.NET & Split() - Split() : Returns a zero-based, one-dimensional array containing a specified number of substrings.

ShotDev Focus:
- VB.NET & Split()

Example

Split.aspx

<%@ Page Language="VB" %>
<%@ Page Language="VB" %>
<script runat="server">

Sub Page_Load(sender As Object, e As EventArgs)
Dim strString As String = "a,b,c,d,e,f"
Dim strSplit1 As Array
Dim strSplit2 As Array
Dim i As Integer

strSplit1 = Split(strString,",")
strSplit2 = strString.Split(",")

For  i = 0 To UBound(strSplit1)
Me.lblText1.Text =  Me.lblText1.Text &  strSplit1(i) & "<br>"
Next

For  i = 0 To strSplit2.Length - 1
Me.lblText2.Text =  Me.lblText2.Text &  strSplit2(i) & "<br>"
Next
End Sub

</script>
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<form runat="server">
<asp:Label id="lblText1" runat="server"></asp:Label>
<hr />
<asp:Label id="lblText2" runat="server"></asp:Label>
</form>
</body>
</html>

Screenshot

VB.NET & Split()
.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.