Skip to content

Correct syntax section of parseInt() reference pages #589

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
May 1, 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
12 changes: 9 additions & 3 deletions Language/Functions/Communication/Serial/parseInt.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Looks for the next valid integer in the incoming serial. The function terminates

In particular:

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


[float]
=== Parameters
`_Serial_`: serial port object. See the list of available serial ports for each board on the link:../../serial[Serial main page]. +
`skipChar`: used to skip the indicated char in the search. Used for example to skip thousands divider.
`lookahead`: the mode used to look ahead in the stream for an integer. Allowed data types: `LookaheadMode`. Allowed `lookahead` values:

* `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.
* `SKIP_NONE`: Nothing is skipped, and the stream is not touched unless the first waiting character is valid.
* `SKIP_WHITESPACE`: Only tabs, spaces, line feeds, and carriage returns are skipped.

`ignore`: used to skip the indicated char in the search. Used for example to skip thousands divider. Allowed data types: `char`

[float]
=== Returns
Expand Down
17 changes: 10 additions & 7 deletions Language/Functions/Communication/Stream/streamParseInt.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ title: Stream.parseInt()

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

In particular:

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

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

[float]
=== Syntax
`stream.parseInt(list)`
`stream.parseInt()` +
`stream.parseInt(lookahead)` +
`stream.parseInt(lookahead, ignore)`

`stream.parseInt(''list', char skipchar')`

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

`list` : the stream to check for ints (`char`)
* `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.
* `SKIP_NONE`: Nothing is skipped, and the stream is not touched unless the first waiting character is valid.
* `SKIP_WHITESPACE`: Only tabs, spaces, line feeds, and carriage returns are skipped.

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

[float]
=== Returns
Expand Down