- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Yash Sanghvi has Published 220 Articles
Yash Sanghvi
171 Views
Defining new functions in Arduino is equivalent to defining the functions in C.The syntax is −Syntaxreturn_type function_name(arg_type arg)The only difference is that in C, the function needs to be declared at the top, if it is invoked before its definition. No such constraint exists in Arduino. The following code demonstrates ... Read More
Yash Sanghvi
5K+ Views
In order to convert a string to lower/upper case, the in-built .toLowerCase() and .toUpperCase() functions can be used.Note: These functions change the original string itself, and don't return a new string with the changes.The implementation is shown below −Examplevoid setup() { Serial.begin(9600); Serial.println(); String s1 = "Hello World"; ... Read More
Yash Sanghvi
5K+ Views
The .replace() function in Arduino allows you to replace a character or a substring with another character/substring in Arduino.Note: This function replaces substrings in the original string itself, and does not return a new string containing the changes.Examples are given in the code below −Examplevoid setup() { Serial.begin(9600); ... Read More
Yash Sanghvi
3K+ Views
In order to convert a string to an integer or a float, the .toInt() and .toFloat() functions can be used. Of course, the string should actually correspond to the integer or floating-point value. For instance, "1.87" can be converted to float. But it doesn't make sense to convert "Hello" to float. ... Read More
Yash Sanghvi
13K+ Views
String concatenation in Arduino is quite straightforward and also robust. You simply use the + operator to join strings. However, it doesn't end with joining two strings. You can concatenate characters, and even integers and floats to strings (Arduino converts the integers and floating-point numbers to string internally). Examples can ... Read More
Yash Sanghvi
13K+ Views
In order to convert a character array to a string, the String() constructor can be used. An example is shown below −Examplevoid setup() { // put your setup code here, to run once: Serial.begin(9600); Serial.println(); char buf[10] = "Hello!"; Serial.print("Char array: "); Serial.println(buf); ... Read More
Yash Sanghvi
7K+ Views
There are several libraries built for Arduino whose functions take in character arrays as inputs instead of strings. Thankfully, Arduino has an inbuilt method (toCharArray()) to covert a String to a Character Array. A sample implementation is given below −Examplevoid setup() { // put your setup code here, to ... Read More
Yash Sanghvi
618 Views
In order to check if two strings are equal, the .equals() function can be used. This returns a Boolean. True if both the strings are equal, else false. An example code is given below −Examplevoid setup() { // put your setup code here, to run once: Serial.begin(9600); ... Read More
Yash Sanghvi
510 Views
The startsWith() function in Arduino helps you determine if a string starts with a specific set of characters. It returns true if the string starts with the substring you specified, else it returns false. An example implementation is given below −Examplevoid setup() { // put your setup code here, ... Read More
Yash Sanghvi
13K+ Views
In order to check if a specific substring exists within a string in Arduino, the indexOf() function can be used. This returns the index of the first occurrence of the character or a string that you are searching for within another string. In case the character or string does not ... Read More
To Continue Learning Please Login
Login with Google