i have method, which have parameter “word” returns Word first and the last letter with string. between first and last letter there is three points. example when you write “stackoverflow” it returns it like that “s…w”
I have this code but i wont work.
namespace stackoverflow
{
class Program
{
static void Main(string[] args)
{
string word = "stackoverflow";
string firsLast = FirsLast(word);
Console.WriteLine(firsLast);
Console.ReadKey();
}
private static string FirsLast(string word)
{
string firsLast = "...";
for (int i = 0; i < word.Length; i += 2)
{
firsLast += word.ElementAt(i);
}
return firsLast;
}
}
}
Why not