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
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Manisha Mali
1.7k
19
1.9k
separate string 172X120X40 in s1=172,s2=120.s3=40 how it is
Aug 31 2016 2:52 AM
i am using mvc 5 ,entityframework,c#
i am having string 172X120X40 .i want to separate this in to 3 separate variable
s1=172,s2=120,s3=40
how will i do that.
Reply
Answers (
2
)
0
Rajeesh Menoth
67
27k
2.7m
Aug 31 2016 4:51 AM
Hi,
Code :
using
System;
public
class
Program
{
public
static
void
Main()
{
string
S1 =
string
.Empty;
string
S2 =
string
.Empty;
string
S3 =
string
.Empty;
string
inputStr =
"172x120x40"
;
string
[] array = inputStr.Split(
'x'
);
Console.WriteLine(
"S1 = "
+ array[0]);
Console.WriteLine(
"S2 = "
+ array[1]);
Console.WriteLine(
"S3 = "
+ array[2]);
}
}
Reference :
https://dotnetfiddle.net/6guPg1
0
Midhun Tp
140
13.2k
1.5m
Aug 31 2016 3:59 AM
Hi,
Please try this code -
string s1, s2, s3;
string k = "172x120x40";
string[] arr = k.Split('x');
s1 = arr[0];
s2 = arr[1];
s3 = arr[2];
Characters and year with Auto increment number.
I want to repeat the lables as well as table data