-
July 1st, 2013, 07:34 PM
#1
concatenation of string and assigning to a varibale
Hello,
I have a c#program,where the string is "time warner cable,charlotte,NC"
so I haave to split this string(comma separated) and I need to get only first value as time warner cable
so that I need to change in db as well as front-end code
I changed in db as LIKE companyname || '%'
but in the front end first I need to declare a variable ,and check the value exists in company name or not and make sure that null or not using if else statement.
how to write the code?
my idea is
int index = 0;
index = comp.companyname indexof (',');
companyname.substring(index,0)
-
July 11th, 2013, 01:30 PM
#2
Re: concatenation of string and assigning to a varibale
Hi,
You ca use this to get the first value of that string.
Code:
string[] splittedString = yourString.Split(',');
string firstPart = splittedString[0];
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|