fork download
  1. using static System.Console;
  2. using System.Linq;
  3.  
  4. public class Program {
  5. public static void Main() {
  6. var optionArray = new string[] { "in the jungle ", " the mighty jungle", " the lion sleeps tonight " };
  7. var newArray = optionArray.Select(s => s.Trim()).ToArray();
  8. foreach (var item in newArray) {
  9. WriteLine($"|{item}|");
  10. }
  11. for (var i = 0; i < optionArray.Length; i++) {
  12. optionArray[i] = optionArray[i].Trim();
  13. }
  14. foreach (var item in optionArray) {
  15. WriteLine($"|{item}|");
  16. }
  17. }
  18. }
  19.  
  20. //https://pt.stackoverflow.com/q/142740/101
Success #stdin #stdout 0.02s 17236KB
stdin
Standard input is empty
stdout
|in the jungle|
|the mighty jungle|
|the lion sleeps tonight|
|in the jungle|
|the mighty jungle|
|the lion sleeps tonight|