Skip to content

Commit 227ec6a

Browse files
authored
Merge pull request #590 from per1234/correct-parsefloat-syntax
Correct syntax section of parseFloat() reference pages
2 parents 81434f4 + f192684 commit 227ec6a

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

Language/Functions/Communication/Serial/parseFloat.adoc

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,29 @@ title: Serial.parseFloat()
1414

1515
[float]
1616
=== Description
17-
`Serial.parseFloat()` returns the first valid floating point number from the Serial buffer. Characters that are not digits (or the minus sign) are skipped. `parseFloat()` is terminated by the first character that is not a floating point number. The function terminates if it times out (see link:../settimeout[Serial.setTimeout()]).
17+
`Serial.parseFloat()` returns the first valid floating point number from the Serial buffer. `parseFloat()` is terminated by the first character that is not a floating point number. The function terminates if it times out (see link:../settimeout[Serial.setTimeout()]).
1818

1919
`Serial.parseFloat()` inherits from the link:../../stream[Stream] utility class.
2020
[%hardbreaks]
2121

2222

2323
[float]
2424
=== Syntax
25-
`_Serial_.parseFloat()`
25+
`_Serial_.parseFloat()` +
26+
`_Serial_.parseFloat(lookahead)` +
27+
`_Serial_.parseFloat(lookahead, ignore)`
2628

2729

2830
[float]
2931
=== Parameters
30-
`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page].
32+
`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. +
33+
`lookahead`: the mode used to look ahead in the stream for a floating point number. Allowed data types: `LookaheadMode`. Allowed `lookahead` values:
34+
35+
* `SKIP_ALL`: all characters other than a minus sign, decimal point, or digits are ignored when scanning the stream for a floating point number. This is the default mode.
36+
* `SKIP_NONE`: Nothing is skipped, and the stream is not touched unless the first waiting character is valid.
37+
* `SKIP_WHITESPACE`: Only tabs, spaces, line feeds, and carriage returns are skipped.
38+
39+
`ignore`: used to skip the indicated char in the search. Used for example to skip thousands divider. Allowed data types: `char`
3140

3241
[float]
3342
=== Returns

Language/Functions/Communication/Stream/streamParseFloat.adoc

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,29 @@ title: Stream.parseFloat()
1414

1515
[float]
1616
=== Description
17-
`parseFloat()` returns the first valid floating point number from the current position. Initial characters that are not digits (or the minus sign) are skipped. `parseFloat()` is terminated by the first character that is not a floating point number. The function terminates if it times out (see link:../streamsettimeout[Stream.setTimeout()]).
17+
`parseFloat()` returns the first valid floating point number from the current position. `parseFloat()` is terminated by the first character that is not a floating point number. The function terminates if it times out (see link:../streamsettimeout[Stream.setTimeout()]).
1818

1919
This function is part of the Stream class, and can be called by any class that inherits from it (Wire, Serial, etc). See the link:../../stream[Stream class] main page for more information.
2020
[%hardbreaks]
2121

2222

2323
[float]
2424
=== Syntax
25-
`stream.parseFloat(list)`
25+
`stream.parseFloat()` +
26+
`stream.parseFloat(lookahead)` +
27+
`stream.parseFloat(lookahead, ignore)`
2628

2729

2830
[float]
2931
=== Parameters
30-
`stream` : an instance of a class that inherits from Stream.
32+
`stream` : an instance of a class that inherits from Stream. +
33+
`lookahead`: the mode used to look ahead in the stream for a floating point number. Allowed data types: `LookaheadMode`. Allowed `lookahead` values:
3134

32-
`list` : the stream to check for floats (`char`)
35+
* `SKIP_ALL`: all characters other than a minus sign, decimal point, or digits are ignored when scanning the stream for a floating point number. This is the default mode.
36+
* `SKIP_NONE`: Nothing is skipped, and the stream is not touched unless the first waiting character is valid.
37+
* `SKIP_WHITESPACE`: Only tabs, spaces, line feeds, and carriage returns are skipped.
38+
39+
`ignore`: used to skip the indicated char in the search. Used for example to skip thousands divider. Allowed data types: `char`
3340

3441
[float]
3542
=== Returns

0 commit comments

Comments
 (0)