July 1st, 2013, 08:34 PM
concatenation of string and assigning to a varibale
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 (',');
July 11th, 2013, 02:30 PM
Re: concatenation of string and assigning to a varibale
You ca use this to get the first value of that string.
string splittedString = yourString.Split(',');
string firstPart = splittedString;
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!