Skip to content

Document String.toDouble() #484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions Language/Variables/Data Types/String/Functions/toDouble.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: "toDouble()"
categories: [ "Data Types" ]
subCategories: [ "StringObject Function" ]
---





= toDouble()


// OVERVIEW SECTION STARTS
[#overview]
--

[float]
=== Description
Converts a valid String to a double. The input String should start with a digit. If the String contains non-digit characters, the function will stop performing the conversion. For example, the Strings "123.45", "123", and "123fish" are converted to 123.45, 123.00, and 123.00 respectively. Note that "123.456" is approximated with 123.46. Note too that floats have only 6-7 decimal digits of precision and that longer Strings might be truncated.

[%hardbreaks]


[float]
=== Syntax
[source,arduino]
----
string.toDouble()
----

[float]
=== Parameters
`string`: a variable of type String


[float]
=== Returns
`double`

If no valid conversion could be performed because the String doesn't start with a digit, a zero is returned.

--
// OVERVIEW SECTION ENDS



// HOW TO USE SECTION ENDS


// SEE ALSO SECTION
[#see_also]
--

[float]
=== See also

[role="example"]
* #EXAMPLE# link: https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings[Built-in String Tutorials]
--
// SEE ALSO SECTION ENDS
1 change: 1 addition & 0 deletions Language/Variables/Data Types/stringObject.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ String stringOne = String(5.698, 3); // using a float and t
* #LANGUAGE# link:../string/functions/startswith[startsWith()]
* #LANGUAGE# link:../string/functions/substring[substring()]
* #LANGUAGE# link:../string/functions/tochararray[toCharArray()]
* #LANGUAGE# link:../string/functions/todouble[toDouble()]
* #LANGUAGE# link:../string/functions/toint[toInt()]
* #LANGUAGE# link:../string/functions/tofloat[toFloat()]
* #LANGUAGE# link:../string/functions/tolowercase[toLowerCase()]
Expand Down