Split string Between Characters from label
Split String two or more Character from label or Variables Using Asp.Net C#.
DEMO
Download
HTML Coding
C# Coding
Next - Code Behind file - add - split for label string with index assign
Split String two or more Character from label or Variables Using Asp.Net C#.
DEMO
Download
HTML Coding
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>How to Split string Between Some characters in label Using
Asp.net C#</title>
</head>
<body>
<form runat="server">
<div align="center">
<br />
<asp:Label ID="lblSplit" runat="server" Text="(DotnetdrizzleS)"></asp:Label>
<br />
<asp:Label ID="lblResult" runat="server" ForeColor="Red"></asp:Label>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Split" OnClick="Button1_Click" /></div>
</form>
</body>
</html>
C# Coding
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
public partial class Default4 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
//
(DotnetdrizzleS)
lblResult.Text = lblSplit.Text.Split('(', ')')[1]; // 1 is
destination character of split (index based)
}
}
Add New Webform - Select Label & Button from
ToolBox - Text add to label
Next - Code Behind file - add - split for label string with index assign
0 comments:
Post a Comment