Arduino String class: features missing (feature request)

オープン
#152 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
cpp
領域
embedded-iot

調査の方向性

このIssueではArduino C++ Stringメソッドが挙げられていますが、ファイルやテストは提供されていません。まず既存のStringクラスとcompareTo/readの動作を確認し、その後、要求されているAPIと改行のセマンティクスをメンテナーと明確にしてください。実装前に、提案された変更のスコープと動作について合意されていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

hi,
for Arduino C++ Strings some features are missing:
.readStringUntil(EOL) or perhaps a new .readln(): to read an entire textline all at once until end of line, discarding any EoL/CR
(e.g., text lines may have \n or \r\n at EoL, so readStringUntil('\n') or readStringUntil('\r') may fail or mess it up)

additionally also helpful:
.insert(substr, pos, len)
.delete(pos, len)
and especially
.TokenArg(token, delimiter1, delimiter2) // edit: optionally also just named .arg()
// returns the value of a token, e.g. for a String containing analog=1234;
String myArg = myString.TokenArg("analog", "=", ";") would return 1234 as a String.

OTOH, IMO .compareTo() is ambiguous, it returns +/-/0 for after/before/ident but completely unclear if or what when neither and they are completely different. Better if it returned NAN/-1/0/+1 for notIn/smaller/ident/bigger.

PS,
just recalled that the WebServer lib provides a method .arg() which works somehow like the requested String.TokenArg() functionality:

int Analog1=0;
String myArg = webserver.arg("analog");
if (myArg  != "") {
      Analog1 = myArg.toInt();
}

That could be also used as a pattern for a String class TokenArg function.

主要言語
C++
スター
306
フォーク
150
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

arduino/ArduinoCore-API のほかの issue

arduino/ArduinoCore-API の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。