Tutorial.StringReplace History

Hide minor edits - Show changes to output

May 02, 2012, at 03:54 PM by Scott Fitzgerald -
Changed lines 37-38 from:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/8.Strings/StringReplace/StringReplace.ino lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/08.Strings/StringReplace/StringReplace.ino lang=arduino tabwidth=4:)
November 16, 2011, at 04:22 AM by Scott Fitzgerald -
Changed lines 37-38 from:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/8.Strings/StringReplace/StringReplace.pde lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/8.Strings/StringReplace/StringReplace.ino lang=arduino tabwidth=4:)
September 19, 2010, at 11:52 PM by Christian Cerrito -
Changed lines 5-6 from:
The [[Reference/StringObject|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 [[Reference/StringObject| '''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 11:51 PM by Christian Cerrito -
Changed lines 5-6 from:
The [[Reference/StringObject|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 [[Reference/StringObject|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 11:51 PM by Christian Cerrito -
Added line 23:
!!!Code
Deleted line 34:
!!!Code
September 19, 2010, at 11: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.

%height=250px%[[Attach:Arduino_bb.png | Attach:Arduino_bb.png]]
[-image developed using [[http://www.fritzing.org |Fritzing]]. For more circuit examples, see the [[http://fritzing.org/projects/|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://arduino.cc/en/pub/code/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://arduino.cc/en/pub/code/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 10: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 10:52 PM by Tom Igoe -
Changed line 33 from:
to:
September 16, 2010, at 10: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://arduino.cc/en/pub/code/master/build/shared/examples/8.Strings/StringReplace/StringReplace.pde lang=arduino tabwidth=4:)
to:
(:source http://arduino.cc/en/pub/code/master/build/shared/examples/8.Strings/StringReplace/StringReplace.pde lang=arduino tabwidth=4:)
August 01, 2010, at 05:01 PM by Tom Igoe -
Added lines 1-49:
''Examples > Strings''

!!!String replace Function

The [[Reference/StringObject|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

Share