StringCharacters - String = reportString.charAt(15...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* String charAt() and setCharAt() Examples of how to get and set characters of a String created 27 July 2010 by Tom Igoe This example code is in the public domain. */ void setup() { Serial.begin(9600); Serial.println("\n\nString charAt() and setCharAt():"); } void loop() { // make a string to report a sensor reading: String reportString = "SensorReading: 456"; Serial.println(reportString); // the reading's most significant digit is at position 15 in the reportString:
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: String mostSignificantDigit = reportString.charAt(15); Serial.println("Most significant digit of the sensor reading is: " + mostSignificantDigit); m // add blank space: Serial.println(); // you can alo set the character of a string. Change the : to a = character reportString.setCharAt(13, '='); Serial.println(reportString); // do nothing while true: while(true); }...
View Full Document

This note was uploaded on 01/31/2011 for the course CS 302 taught by Professor J.parker during the Spring '08 term at University of Texas.

Ask a homework question - tutors are online