How can we convert a string representation of a number, to number type in TypeScript ?

Solution of string to number in TypeScript

Like in JavaScript, we can use the parseInt or parseFloat functions, or simply use the unary + operator :

var x = "32";
var y: number = +x;

Read also : Convert String to int in Java

Laisser un commentaire