Loading...

Tutorial.StringReplace History

Hide minor edits - Show changes to markup

May 02, 2012, at 09:54 AM by Scott Fitzgerald -
Changed lines 37-38 from:

(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/8.Strings/StringReplace/StringReplace.ino lang=arduino tabwidth=4:)

to:

(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/08.Strings/StringReplace/StringReplace.ino lang=arduino tabwidth=4:)

November 15, 2011, at 10:22 PM by Scott Fitzgerald -
Changed lines 37-38 from:

(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/8.Strings/StringReplace/StringReplace.pde lang=arduino tabwidth=4:)

to:

(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/8.Strings/StringReplace/StringReplace.ino lang=arduino tabwidth=4:)

September 19, 2010, at 05:52 PM by Christian Cerrito -
Changed lines 5-6 from:

The String replace() function allows you to replace all instances of a given character with another character. You can also use replace to replace substrings of a string with a different substring.

to:

The String replace() function allows you to replace all instances of a given character with another character. You can also use replace to replace substrings of a string with a different substring.

September 19, 2010, at 05:51 PM by Christian Cerrito -
Changed lines 5-6 from:

The String replace() function allows you to replace all instances of a given character with another character.You can also use replace to replace substrings of a string with a different substring.

to:

The String replace() function allows you to replace all instances of a given character with another character. You can also use replace to replace substrings of a string with a different substring.

September 19, 2010, at 05:51 PM by Christian Cerrito -
Added line 23:

Code

Deleted line 34:

Code

September 19, 2010, at 05:50 PM by Christian Cerrito -
Changed line 9 from:

No external hardware is required.

to:
  • Arduino Board
Deleted lines 11-22:

Caution: If you try to replace a substring that's more than the whole string itself, nothing will be replaced. For example: (:div class=code :) (:source lang=arduino tabwidth=4:)

  String stringOne = "<html><head><body>";
  String stringTwo = stringOne.replace("<html><head></head><body></body></html>", "Blah");

(:sourceend:) (:divend:)

In this case, the code will compile, but stringOne will remain unchanged, since the replacement substring is more than the String itself.

Deleted line 12:
Changed lines 14-18 from:

There is no circuit for this example.

to:

There is no circuit for this example, though your Arduino must be connected to your computer via USB.

image developed using Fritzing. For more circuit examples, see the Fritzing project page

Changed lines 21-24 from:

Code

to:

Caution: If you try to replace a substring that's more than the whole string itself, nothing will be replaced. For example:

Changed lines 26-28 from:

(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/8.Strings/StringReplace/StringReplace.pde lang=arduino tabwidth=4:)

to:

(:source lang=arduino tabwidth=4:)

  String stringOne = "<html><head><body>";
  String stringTwo = stringOne.replace("<html><head></head><body></body></html>", "Blah");

(:sourceend:)

Added lines 32-40:

In this case, the code will compile, but stringOne will remain unchanged, since the replacement substring is more than the String itself.

Code

(:div class=code :)

(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/8.Strings/StringReplace/StringReplace.pde lang=arduino tabwidth=4:)

(:divend:)

Added line 42:
Added lines 55-57:

September 16, 2010, at 04:53 PM by Tom Igoe -
Changed lines 16-17 from:

(:source lang=arduino tabwidth=4:) String stringOne = "<html><head><body>";

to:

(:source lang=arduino tabwidth=4:)

  String stringOne = "<html><head><body>";
September 16, 2010, at 04:52 PM by Tom Igoe -
Changed line 33 from:
to:
September 16, 2010, at 04:52 PM by Tom Igoe -
Changed lines 16-17 from:

[@

  String stringOne = "<html><head><body>";
to:

(:source lang=arduino tabwidth=4:) String stringOne = "<html><head><body>";

Changed line 18 from:

@]

to:

(:sourceend:)

Changed line 32 from:
 (:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/8.Strings/StringReplace/StringReplace.pde lang=arduino  tabwidth=4:)
to:

(:source http://github.com/arduino/Arduino/raw/master/build/shared/examples/8.Strings/StringReplace/StringReplace.pde lang=arduino tabwidth=4:)

August 01, 2010, at 11:01 AM by Tom Igoe -
Added lines 1-49:

Examples > Strings

String replace Function

The String replace() function allows you to replace all instances of a given character with another character.You can also use replace to replace substrings of a string with a different substring.

(:div class=BOM :)

Hardware Required

No external hardware is required. (:divend:)

Caution: If you try to replace a substring that's more than the whole string itself, nothing will be replaced. For example: (:div class=code :)

  String stringOne = "<html><head><body>";
  String stringTwo = stringOne.replace("<html><head></head><body></body></html>", "Blah");

(:divend:)

In this case, the code will compile, but stringOne will remain unchanged, since the replacement substring is more than the String itself.

Circuit

(:div class=circuit :) There is no circuit for this example. (:divend:)

Code

(:div class=code :)

(:source




Bookmark and Share