In python I am trying to just do object[1:]
, skipping the first element and then returning the rest of the string[]
. What is the best way to go about this?
Now would be a good time to learn about LINQ - you want Skip(1)
to skip the first element. Then you can use ToArray
to create an array if you really need to. For example:
string[] original = { "a", "b", "c" };
IEnumerable<string> skippedFirst = original.Skip(1);
foreach (string x in skippedFirst)
{
Console.WriteLine(x); // b then c
}
string[] skippedFirstAsArray = skippedFirst.ToArray();
See more on this question at Stackoverflow