TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Split String And Char From Alphanumeric String In C#
Bikesh Srivastava
Aug 22
2016
Code
5.4
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
Test.zip
using
System;
using
System.Net.NetworkInformation;
using
System.Net;
using
System.Net.Sockets;
using
System.Text.RegularExpressions;
namespace
Example
{
class
Program
{
static
void
Main()
{
string
var =
"1ab23cd4ghg4g3g2j34g"
;
string
str = Regex.Replace(var, @
"\d"
,
""
);
string
num = Regex.Replace(var, @
"\D"
,
""
);
int
total = var.Trim().Length;
Console.WriteLine(
"Main String :: "
+ var);
Console.WriteLine(
"Total number of char :: "
+total);
Console.WriteLine(
"Letters :: "
+ str);
Console.WriteLine(
"Number :: "
+ num.ToString());
Console.ReadLine();
}
}
}
Split String
Alphanumeric String
C#