Click here to Skip to main content
15,911,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
if (s[1].Length > 6)
{
    s[1].Insert(6, " ");
    string[] a = s[1].Split(' ');
    sales = sales + " " + a[0];
}
Posted
Comments
Chris Reynolds (UK) 15-Feb-13 4:56am    
What do you expect the code to do? Are you seeing an error or an unexpected result?

1 solution

It looks like you're trying to take the first 6 characters from s[1].
If that is the case then something like this might work for you;
C#
if (s[1].Length > 6)
{
  sales = sales + " " + s[1].SubString(0, 6);
}


Hope this helps,
Fredrik
 
Share this answer
 
Comments
carm_ella 15-Feb-13 5:00am    
thank u! :)
Fredrik Bornander 15-Feb-13 5:05am    
Glad I could help.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900