home > 比較編 > F#, Scala, Haskell > strings >

ForNext

Only Do What Only You Can Do

050. string to number

VBScript

JScript

Perl

PHP

Python

Ruby

PowerShell

Scala

"3".toInt
"3.14".toFloat
raises NumberFormatException if string doesn't completely parse

F#

OCaml

int_of_string "3"
float_of_string "3.14"

Haskell

read "3"::Integer
read "3.14"::Double
raises exception if string doesn't completely parse

C

C++

C++Builder

VC++

C#

Java

Objective-C

D

VB

VB.NET

Delphi

Ada

PL/SQL

T-SQL

inserted by FC2 system