Scenario:
I have list of Networks Name in Database Table with numbers e.g (1. Facebook, 2. Twitter, 3. MySpace, 4. hi5 ...
) and I select one Network from database (e.g 2. Twitter
).
What I Did:
string Selected = "12.FaceBook";
int k=3;
string[] myArray = new string[Selected.Length];
for (int i = 0; i < Selected.Length; i++)
{
myArray[i] = Selected[k].ToString();
k++;
}
and sucked how to join myArray
and print in
DevComponents.DotNetBar.MessageBoxEx.Show("?");
What I Want:
output as:
"Facebook"
or "Twitter"
without numbers.
This should do it:
string joined = string.Join("", myArray);
DevComponents.DotNetBar.MessageBoxEx.Show(joined);
If you want to put a separator between the joined strings, that's the first parameter of string.Join()
. For example, to put a space between them:
string joined = string.Join(" ", myArray);
However, your code to actually create the string array in the first place looks wrong. Do you get a single string back from the database for the required network, or do you get a single string containing all networks that you have to parse yourself?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With