Skip to content

Commit c92d1ee

Browse files
committed
Correct syntax section of parseInt() reference pages
Both the Stream.parseInt() and Serial.parseInt() reference pages had erroneous information in their syntax documentation. Reference: https://github.com/arduino/ArduinoCore-API/blob/1.0.0/api/Stream.h#L86
1 parent 81434f4 commit c92d1ee

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

Language/Functions/Communication/Serial/parseInt.adoc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ Looks for the next valid integer in the incoming serial. The function terminates
2121

2222
In particular:
2323

24-
* Initial characters that are not digits or a minus sign, are skipped; +
2524
* Parsing stops when no characters have been read for a configurable time-out value, or a non-digit is read; +
2625
* If no valid digits were read when the time-out (see Serial.setTimeout()) occurs, 0 is returned;
2726
[%hardbreaks]
@@ -30,13 +29,20 @@ In particular:
3029
[float]
3130
=== Syntax
3231
`_Serial_.parseInt()` +
33-
`_Serial_.parseInt(char skipChar)`
32+
`_Serial_.parseInt(lookahead)` +
33+
`_Serial_.parseInt(lookahead, ignore)`
3434

3535

3636
[float]
3737
=== Parameters
3838
`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. +
39-
`skipChar`: used to skip the indicated char in the search. Used for example to skip thousands divider.
39+
`lookahead`: the mode used to look ahead in the stream for an integer. Allowed data types: `LookaheadMode`. Allowed `lookahead` values:
40+
41+
* `SKIP_ALL`: all characters other than digits or a minus sign are ignored when scanning the stream for an integer. This is the default mode.
42+
* `SKIP_NONE`: Nothing is skipped, and the stream is not touched unless the first waiting character is valid.
43+
* `SKIP_WHITESPACE`: Only tabs, spaces, line feeds, and carriage returns are skipped.
44+
45+
`ignore`: used to skip the indicated char in the search. Used for example to skip thousands divider. Allowed data types: `char`
4046

4147
[float]
4248
=== Returns

Language/Functions/Communication/Stream/streamParseInt.adoc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ title: Stream.parseInt()
1414

1515
[float]
1616
=== Description
17-
`parseInt()` returns the first valid (long) integer number from the current position. Initial characters that are not integers (or the minus sign) are skipped.
17+
`parseInt()` returns the first valid (long) integer number from the current position.
1818

1919
In particular:
2020

21-
* Initial characters that are not digits or a minus sign, are skipped; +
2221
* Parsing stops when no characters have been read for a configurable time-out value, or a non-digit is read; +
2322
* If no valid digits were read when the time-out (see link:../streamsettimeout[Stream.setTimeout()]) occurs, 0 is returned;
2423

@@ -28,17 +27,21 @@ This function is part of the Stream class, and can be called by any class that i
2827

2928
[float]
3029
=== Syntax
31-
`stream.parseInt(list)`
30+
`stream.parseInt()` +
31+
`stream.parseInt(lookahead)` +
32+
`stream.parseInt(lookahead, ignore)`
3233

33-
`stream.parseInt(''list', char skipchar')`
3434

3535
[float]
3636
=== Parameters
37-
`stream` : an instance of a class that inherits from Stream.
37+
`stream` : an instance of a class that inherits from Stream. +
38+
`lookahead`: the mode used to look ahead in the stream for an integer. Allowed data types: `LookaheadMode`. Allowed `lookahead` values:
3839

39-
`list` : the stream to check for ints (`char`)
40+
* `SKIP_ALL`: all characters other than digits or a minus sign are ignored when scanning the stream for an integer. This is the default mode.
41+
* `SKIP_NONE`: Nothing is skipped, and the stream is not touched unless the first waiting character is valid.
42+
* `SKIP_WHITESPACE`: Only tabs, spaces, line feeds, and carriage returns are skipped.
4043

41-
`skipChar`: used to skip the indicated char in the search. Used for example to skip thousands divider.
44+
`ignore`: used to skip the indicated char in the search. Used for example to skip thousands divider. Allowed data types: `char`
4245

4346
[float]
4447
=== Returns

0 commit comments

Comments
 (0)