I Have table like this......
House_no
6-1
6-1-2
6-1/2
6-1/78
6-12/5
6-3-124 ,hyderabad
6-3/2
6-3-19876 ,yuyu
select only first '-' only.............
I WANT OUTPUT LIKE THIS...........
6-1
6-1/2
6-1/78
6-3/2
6-12/5
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
FroglegPosted Dec 11, 2013, 1:09 PM
List
public void sortString()
{
for (int i = 0; i < 7; i++)
{
if (!removeBar(str[i]))
{
myList.Add(str[i]);
}
}
}
public bool removeBar(string ss)
{
int count = 0;
bool hyphon = false;
char[] chr = ss.ToCharArray();
foreach (char c in chr)
{
if(c == '-')
{
count++;
}
if (count>1)
{
hyphon = true;
return hyphon;
}
}
return hyphon;
}