Skip to content

Instantly share code, notes, and snippets.

@nadavmatalon
Created October 9, 2016 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nadavmatalon/2f001bad0765b5e6f8d96d0729eb0d73 to your computer and use it in GitHub Desktop.
Save nadavmatalon/2f001bad0765b5e6f8d96d0729eb0d73 to your computer and use it in GitHub Desktop.
// Code Author: Mikal Hart
// Code Source: http://arduiniana.org/libraries/pstring/
// Direct use (no constructor):
char buffer[30];
float pi 3.14159;
PString(buffer, sizeof(buffer), pi);
// Construct an object:
char buffer[50];
PString str(buffer, sizeof(buffer));
str = "Joe";
str += 45;
// Useful functions:
Serial.print(str); // prints str
str.length(); // actual length of str
str.capacity(); // str general capacity
str.begin(); // Resets str (sets pointer to the begining of str)
str == "other" // Comparison between str and another string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment