Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
var b = a.map(int.parse).toList();
b = a.stream()
.map(Integer::parseInt)
.toList();
@b = map { $_ += 0 } @a
Technically, Perl doesn't have types, however, deep in its guts it does know if a variable has been used in a string context. This is for interacting with other languages and protocols. The '+=0' 'numifies' the entry.
b = [int(elem) for elem in a]
b = [*map(int, a)]
let b: Vec<i32> = a.iter().flat_map(|s| s.parse().ok()).collect();
ok converts a Result to an Option. flat_map collects all values of Some.
let b: Vec<i64> = a.iter().map(|x| x.parse::<i64>().unwrap()).collect();
a has type Vec<&str>
For i = LBound(a) To UBound(a)
b(i) = CInt(a(i))
Next