Introduction:
Here I will explain how to split string in c#, vb.net using asp.net or split string with special characters in c#, vb.net or Split String with Comma, Space in c#, vb.net.
Here I will explain how to split string in c#, vb.net using asp.net or split string with special characters in c#, vb.net or Split String with Comma, Space in c#, vb.net.
Description:
In previous posts I explained Remove last character from string in C#, jQuery Remove first or last characters from string, SQL Server Query to remove first last characters from string, and many articles relating to Asp.net, c#, vb.net, JQuery. Now I will explain how to split string in c#, vb.net using asp.net.
In previous posts I explained Remove last character from string in C#, jQuery Remove first or last characters from string, SQL Server Query to remove first last characters from string, and many articles relating to Asp.net, c#, vb.net, JQuery. Now I will explain how to split string in c#, vb.net using asp.net.
Split String with one character in C#
protected void
Page_Load(object sender, EventArgs e)
{
string istr = "Welcome
to aspdotnet-suresh.com.";
string []ostr = istr.Split("-".ToCharArray());
foreach (string s in ostr)
{
Response.Write(s+"<br/>");
}
}
|
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim istr As String = "welcome
to aspdotnet-suresh.com."
Dim ostr As String() = istr.Split("-".ToCharArray())
For Each s As String In ostr
Response.Write(s & "<br/>")
Next
End Sub
|
Welcome to aspdotnet
suresh.com. |
Split String with multiple
characters in C#
protected void
Page_Load(object sender, EventArgs e)
{
string istr = "welcome,
to, aspdotnet-suresh.com.";
string []ostr = istr.Split(",-.".ToCharArray());
foreach (string s in ostr)
{
Response.Write(s+"<br/>");
}
}
|
Split String with multiple
characters in VB.NET
Protected Sub
Page_Load(ByVal sender As Object, ByVal e As
EventArgs) Handles Me.Load
Dim istr As String = "welcome,
to, aspdotnet-suresh.com."
Dim ostr As String() = istr.Split(",-.".ToCharArray())
For Each s As String In ostr
Response.Write(s & "<br/>")
Next
End Sub
|
welcome
to aspdotnet suresh com |
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
4 comments :
Nice Example....
This code is useful for me a lot
how to seperate numbers and charaters from string
Hi Sir Good Morning,
In my project i need to split all types of files and merge the splited file,can you please help me..
Thanks in Advance.
Note: Only a member of this blog may post a comment.