6 examples of 'unity string to float' in JavaScript

Every line of 'unity string to float' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
65function float(str) {
66 if (!str) {
67 return 0;
68 }
69 return parseFloat(str, 10);
70}
82function parseFloatList(string) {
83 return $.map(string.split(','), function (x) { return parseFloat(x.trim()); });
84}
75function float(val) {
76 /* jshint eqnull: true */
77 if (val == null) {
78 return null;
79 }
80 var r = parseFloat(val);
81 return isNaN(r) ? val : r;
82}
23parseFloat() {
24 return new Value(this.response, 'Text of ' + this.name, parseFloat(this.toString()));
25}
41function stringToFloat(value) {
42 return parseFloat(value.replace(/[^0-9,]/g, '').replace(',', '.'));
43}
25function parseFloat(v: any) {
26 if (v == undefined) {
27 return 0 / 0;
28 }
29
30 const num = tonumber(v);
31 if (num === null) {
32 return 0 / 0;
33 }
34
35 return num;
36}

Related snippets