String.indexOf()
Description
Localise un caractère ou un String dans un autre objet String. Par défaut, recherche depuis le début de l'objet String, mais peut également débuter la recherche à partir d'un emplacement donné, permettant la localisation de toutes les instances du caractère ou du String à chercher.
Syntaxe
Paramètres
- string: une variable de type String()
- valeur: la valeur à chercher (type char ou String)
- debut: l'emplacement du début de la recherche.
※ Remarque:
l'index du premier caractère est 0.
Valeurs Renvoyées
- Renvoie l'emplacement où valeur a été trouvé dans l'objet string, ou -1 si n'a pas été trouvé.
Exemple
The result on Serial Monitor:
※ Remarque:
If the string is modified, it is highly recommended using String.reserve() to prevent the memory fragmentation issue
Voir Également
- Langage: Arduino - String
- Langage: String.charAt()
- Langage: String.compareTo()
- Langage: String.concat()
- Langage: String.endsWith()
- Langage: String.equals()
- Langage: String.equalsIgnoreCase()
- Langage: String.getBytes()
- Langage: String.lastIndexOf()
- Langage: String.length()
- Langage: String.replace()
- Langage: String.setCharAt()
- Langage: String.startsWith()
- Langage: String.substring()
- Langage: String.toCharArray()
- Langage: String.toLowerCase()
- Langage: String.toUpperCase()
- Langage: String.trim()
※ ARDUINO BUY RECOMMENDATION
Arduino UNO R3 | |
Arduino Starter Kit |