Logo

Programming-Idioms

  • Haskell
  • C++
  • Pascal

Idiom #258 Convert list of strings to list of integers

Convert the string values from list a into a list of integers b.

uses classes, systutils, fgl;
var
  a: TStringList;
  b: specialize TList<Integer>;
...
for i := 0 to a.count-1 do b.add(IntToStr(a[i]));
System.Linq;
var b = a.Select(i => int.Parse(i)).ToList();

New implementation...