String startsWith and endsWith Functions
For code reviewers and auditors: identify in context every change made between two or three source code hierarchies. Create a standalone HTML or XML report of your findings. Add bookmarks and comments to a file or folder comparison, then save it as a single-file archive for emailing to other team members for review.
The String functions
startsWith()
and endsWith()
allow you to check what character or substring a given String starts or ends with. They're basically special cases of substring
.Hardware Required
- Arduino or Genuino Board
Circuit
There is no circuit for this example, though your board must be connected to your computer via USB and the serial monitor window of the Arduino Software (IDE) should be open..
image developed using Fritzing. For more circuit examples, see the Fritzing project page
Code
startsWith()
and endsWith()
can be used to look for a particular message header, or for a single character at the end of a String. They can also be used with an offset to look for a substring starting at a particular position. For example:This is functionally the same as this:
Caution:If you look for a position that's outside the range of the string,you'll get unpredictable results. For example, in the example above stringOne.startsWith('200 OK', 16) wouldn't check against the String itself, but whatever is in memory just beyond it. For best results, make sure the index values you use for
startsWith
and endsWith
are between 0 and the String's length()
./*
String startWith() and endsWith()
Examples of how to use startsWith() and endsWith() in a String
created 27 Jul 2010
modified 2 Apr 2012
by Tom Igoe
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/StringStartsWithEndsWith
*/
voidsetup(){
// Open serial communications and wait for port to open:
Serial.begin(9600);
while(!Serial){
;// wait for serial port to connect. Needed for native USB port only
}
// send an intro:
Serial.println('nnString startsWith() and endsWith():');
Serial.println();
}
voidloop(){
// startsWith() checks to see if a String starts with a particular substring:
String stringOne ='HTTP/1.1 200 OK';
Serial.println(stringOne);
if(stringOne.startsWith('HTTP/1.1')){
Serial.println('Server's using http version 1.1');
}
// you can also look for startsWith() at an offset position in the string:
stringOne ='HTTP/1.1 200 OK';
if(stringOne.startsWith('200 OK',9)){
Serial.println('Got an OK from the server');
}
// endsWith() checks to see if a String ends with a particular character:
String sensorReading ='sensor = ';
sensorReading +=analogRead(A0);
Serial.print(sensorReading);
if(sensorReading.endsWith('0')){
Serial.println('. This reading is divisible by ten');
}else{
Serial.println('. This reading is not divisible by ten');
}
// do nothing while true:
while(true);
}
String startWith() and endsWith()
Examples of how to use startsWith() and endsWith() in a String
created 27 Jul 2010
modified 2 Apr 2012
by Tom Igoe
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/StringStartsWithEndsWith
*/
voidsetup(){
// Open serial communications and wait for port to open:
Serial.begin(9600);
while(!Serial){
;// wait for serial port to connect. Needed for native USB port only
}
// send an intro:
Serial.println('nnString startsWith() and endsWith():');
Serial.println();
}
voidloop(){
// startsWith() checks to see if a String starts with a particular substring:
String stringOne ='HTTP/1.1 200 OK';
Serial.println(stringOne);
if(stringOne.startsWith('HTTP/1.1')){
Serial.println('Server's using http version 1.1');
}
// you can also look for startsWith() at an offset position in the string:
stringOne ='HTTP/1.1 200 OK';
if(stringOne.startsWith('200 OK',9)){
Serial.println('Got an OK from the server');
}
// endsWith() checks to see if a String ends with a particular character:
String sensorReading ='sensor = ';
sensorReading +=analogRead(A0);
Serial.print(sensorReading);
if(sensorReading.endsWith('0')){
Serial.println('. This reading is divisible by ten');
}else{
Serial.println('. This reading is not divisible by ten');
}
// do nothing while true:
while(true);
}
See Also
- String object – Your Reference for String objects
- CharacterAnalysis - We use the operators that allow us to recognise the type of character we are dealing with.
- StringAdditionOperator - Add strings together in a variety of ways.
- StringAppendOperator - Use the += operator and the concat() method to append things to Strings
- StringCaseChanges - Change the case of a string.
- StringCharacters - Get/set the value of a specific character in a string.
- StringComparisonOperators - Get/set the value of a specific character in a string.
- StringConstructors - Initialize string objects.
- StringIndexOf - Look for the first/last instance of a character in a string.
- StringLength - Get the length of a string.
- StringLengthTrim - Get and trim the length of a string.
- StringReplace - Replace individual characters in a string.
- StringSubstring - Look for 'phrases' within a given string.
- StringToInt - Allows you to convert a String to an integer number.
Last revision 2015/08/11 by SM
Mosaic Guppy Wallpaper 1.2.0 | digiaquascr | |||
---|---|---|---|---|
| ||||
Platform: Windows, Win98, WinXP | Desktop- Themes & Wallpaper | |||
License: Freeware | Size: 3.3 MB | Released: 07 August, 2014 | ||
Download: http://www.digiaquascr.com/GuppyWallpaper/MosaicGuppyWallpaper/MosaicGuppyWallpaper.exe | ||||
Mosaic Guppy - Wallpaper - Free Download |
Photo Mosaic 1.0 | Photo Mosaic | |||
---|---|---|---|---|
| ||||
Platform: Windows | Desktop- Screen Savers: Art | |||
License: Freeware | Size: 15.6 MB | Released: 14 June, 2012 | ||
Download: http://assets0.damcdn.com/photomosaic.exe |
Grass Guppy Wallpaper 1.2.0 | digiaquascr | |||
---|---|---|---|---|
| ||||
Platform: Windows, Win98, WinXP | Desktop- Themes & Wallpaper | |||
License: Freeware | Size: 3.3 MB | Released: 29 October, 2014 | ||
Download: http://digiaquascr.com/GuppyWallpaper/GrassGuppyWallpaper/GrassGuppyWallpaper.exe | ||||
Grass Guppy - Wallpaper - Free Download |
King Cobra Guppy Wallpaper 1.2.0 | digiaquascr | |||
---|---|---|---|---|
| ||||
Platform: Windows, Win98, WinXP | Desktop- Themes & Wallpaper | |||
License: Freeware | Size: 3.3 MB | Released: 02 November, 2014 | ||
Download: http://www.digiaquascr.com/GuppyWallpaper/KingCobraGuppy/KingCobraGuppy.exe | ||||
King Cobra - Guppy - Wallpaper - Free Download |
Metal Guppy Fish Wallpaper 1.2.0 | digiaquascr | |||
---|---|---|---|---|
| ||||
Platform: Windows, Win98, WinXP | Desktop- Themes & Wallpaper | |||
License: Freeware | Size: 2.6 MB | Released: 16 November, 2014 | ||
Download: http://www.digiaquascr.com/GuppyWallpaper/metalguppyfish/MetalGuppyFishSetup.exe | ||||
Metal Guppy - Fish - Wallpape - Free |
POV Sphere Mosaic 1.00 | AmphiSoft | |||
---|---|---|---|---|
| ||||
Platform: Win95, Win98, WinME, WinNT 4.x | Audio & Multimedia- Other | |||
License: Freeware | Size: 10.9 MB | Released: 12 January, 2009 | ||
Download: http://photoshop.msk.ru/povsphere/povsphere.zip |
Mosaic logic onlie game v10.31 | Mosaic logic onlie game | |||
---|---|---|---|---|
| ||||
Platform: Windows | Games & Entertainment- Puzzle & Word Games | |||
License: Freeware | Size: 18.0 KB | Released: 20 May, 2009 | ||
Download: http://www.hohohu.com/puzzle/mosaic.zip |
Mosaizer Lite 1.4 | APP Helmond | |||
---|---|---|---|---|
| ||||
Platform: Windows, Win98, WinXP | Graphic Apps- Other | |||
License: Freeware | Size: 4.4 MB | Released: 08 February, 2013 | ||
Download: http://www.mosaizer.com/Download/MosaizerLite.zip | ||||
Photo Mosaic Creator - Mosaizer - Photo Tiling - Photo Mosaics |
WidsMob Montage 1.6.1170 | WidsMob Technology Co., Ltd. | |||
---|---|---|---|---|
| ||||
Platform: Mac OS X | Graphic Apps- Editors | |||
License: Shareware | Size: 1.6 MB | Released: 23 September, 2018 | ||
Download: http://download.widsmob.com/pro/widsmob_montage.dmg | ||||
Mosaic Maker - Montage Maker - Create Mosaic - Make Montage |
AMP Tile Viewer 2.01 | Alberto Martinez Perez | |||
---|---|---|---|---|
| ||||
Platform: Win95, Win98, WinME, WinNT 4.x | Graphic Apps- Viewers | |||
License: Freeware | Size: 404.0 KB | Released: 28 July, 2008 | ||
Download: http://www.ampsoft.net/files/TileViewerSetup.exe |
mosascii m2 2.1.200 | Robert DeFusco | |||
---|---|---|---|---|
| ||||
Platform: Win95, Win98, WinME, WinNT 3.x | Graphic Apps- Viewers | |||
License: Freeware | Size: 5.1 MB | Released: 28 July, 2008 | ||
Download: http://www.mosasciim2.com/mosm2set.exe |
Mosaizer 5 | APP Helmond | |||
---|---|---|---|---|
| ||||
Platform: Windows, WinXP, Windows 95, Windows2000 | Graphic Apps | |||
License: Freeware | Size: 4.5 MB | Released: 28 July, 2008 | ||
Download: http://www.mosaizer.com/Download/MosaizerDemo.zip |
AnimalsX16 1.0 | Gectosoft | |||
---|---|---|---|---|
| ||||
Platform: Win95, Win98, WinME, WinNT 4.x | Audio & Multimedia- Other | |||
License: Freeware | Size: 3.4 MB | Released: 12 January, 2009 | ||
Download: http://www.gectosoft.com/animalsX16setup.exe |
Global Satellite Map 3.0 | Tian mao qiang | |||
---|---|---|---|---|
| ||||
Platform: Windows 98, Windows2000, WindowsXP | Audio & Multimedia- Other | |||
License: Freeware | Size: 2.3 MB | Released: 12 January, 2009 | ||
Download: http://ipphone.uhome.net |
Mystical Dimensions | appleblossomart.com | |||
---|---|---|---|---|
| ||||
Platform: Windows | Desktop- Screen Savers: Other | |||
License: Freeware | Size: 2.5 MB | Released: 20 March, 2012 | ||
Download: http://files.themesunlimited.com/files/S/Mystical_Dimensions-79402.exe |
![Mapmerge Serial Mapmerge Serial](http://www.gpsvsem.ru/image/soft/windows/map_merge/map_merge.png)
RichMosaic 2 4 | pantson.com | |||
---|---|---|---|---|
| ||||
Platform: Windows | Graphic Apps- Other | |||
License: Freeware | Size: 1.3 MB | Released: 15 February, 2012 | ||
Download: http://www.pantson.com/richmosaic/RichMosaic-2.04.zip |
mosascii m2 2.1.200 Beta 3 | elitemrp.net | |||
---|---|---|---|---|
| ||||
Platform: Windows | Graphic Apps- Gallery & Cataloging Tools | |||
License: Freeware | Size: 5.1 MB | Released: 28 June, 2012 | ||
Download: http://www.mosasciim2.com/mosm2set.exe |
Animosaix Screensaver 1.3 | Twins Software Solutions Ltd. | |||
---|---|---|---|---|
| ||||
Platform: Windows | Desktop- Screen Savers: Art | |||
License: Freeware | Size: 2.9 MB | Released: 04 February, 2012 | ||
Download: http://www.animosaix.com/amsetup.exe |
IMosaic 0.9 | IMosaic | |||
---|---|---|---|---|
| ||||
Platform: Windows | Graphic Apps- Gallery & Cataloging Tools | |||
License: Freeware | Size: 437.5 KB | Released: 03 May, 2012 | ||
Download: http://www.imosaic.net/download.php?get=IMosaicSetup_0_9_6.msi |
MosariZer 0.2.3 Alpha | mosarizer.sourceforge.net | |||
---|---|---|---|---|
| ||||
Platform: Windows | Graphic Apps- Editors | |||
License: Freeware | Size: 40.5 KB | Released: 12 January, 2013 | ||
Download: http://mosarizer.sourceforge.net |
Hugin 2011.4.0 | hugin.sourceforge.net | |||
---|---|---|---|---|
| ||||
Platform: Windows | Graphic Apps- Editors | |||
License: Freeware | Size: 25.1 MB | Released: 02 January, 2013 | ||
Download: http://hugin.sourceforge.net |
Wallpapperer 1.0 | wallpaperer.googlecode.com | |||
---|---|---|---|---|
| ||||
Platform: Windows | Desktop- Themes & Wallpaper | |||
License: Freeware | Size: 15.3 KB | Released: 30 December, 2012 | ||
Download: https://code.google.com/p/wallpaperer/ |
Splendid Butterflies Free Screensaver 1.0 | SAVERS4FREE.COM | |||
---|---|---|---|---|
| ||||
Platform: Win95, Win98, WinME, WinXP | Audio & Multimedia- Other | |||
License: Freeware | Size: 3.9 MB | Released: 12 January, 2009 | ||
Download: http://www.savers4free.com/files/splendid_butterflies_free_screensaver.exe |
Mandala maker 1 | _City Cat games | |||
---|---|---|---|---|
| ||||
Platform: Mac OS, Mac PPC, Win 3.1x, Win95 | Audio & Multimedia- Other | |||
License: Freeware | Size: 2.4 MB | Released: 12 January, 2009 | ||
Download: http://www.citycat.ru/iq/mandala000.zip |
Mosaizer Pro 9.0 B 116 | APP Helmond | |||
---|---|---|---|---|
| ||||
Platform: Windows | Graphic Apps- Editors | |||
License: Freeware | Size: 12.4 MB | Released: 27 January, 2012 | ||
Download: http://www.mosaizer.com/Download/MosaizerDemo.zip |
Map Merge utility 1.0 | OziExplorer | |||
---|---|---|---|---|
| ||||
Platform: Windows | Network & Internet- Browser Tools | |||
License: Freeware | Size: 3.3 MB | Released: 10 March, 2012 | ||
Download: http://www.oziexplorer3.com/mapmerge/ozimapmerge_setup.exe |
EtherWatch 2.0 | Etherwatch | |||
---|---|---|---|---|
| ||||
Platform: Windows | Network & Internet- Network Monitoring | |||
License: Freeware | Size: 6.5 MB | Released: 15 April, 2012 | ||
Download: http://sourceforge.net/projects/etherwatch/files/EtherWatch/2.01/EtherWatch2.01-win32.zip/download |
EQMosaic 1.1 | EQMOD Project | |||
---|---|---|---|---|
| ||||
Platform: Windows | Business- Math & Scientific Tools | |||
License: Freeware | Size: 385.6 KB | Released: 07 May, 2012 | ||
Download: http://eq-mod.sourceforge.net/mosindex.html |
FreeSweetGames Mosaic 3.2.1940 | FreeSweetGames | |||
---|---|---|---|---|
| ||||
Platform: Windows, Win98, WinME, WinXP | Games & Entertainment- Puzzle & Word Games | |||
License: Freeware | Size: 674.0 KB | Released: 29 April, 2013 | ||
Download: http://freesweetgames.ru/files/games/fsgMosaic.exe |
MOSAnICk 1.21 | www.radivarl.demon.co.uk | |||
---|---|---|---|---|
| ||||
Platform: Windows | Graphic Apps- Editors | |||
License: Freeware | Size: 52.2 KB | Released: 09 January, 2013 | ||
Download: http://www.radivarl.demon.co.uk |
Free Download 64 Notice: Free Download 64 is not responsible for Mosaic Guppy software you are downloading nor for details provided about the software listed here about Mosaic Guppy, as developers can modify program information without notifying us. Even if we try to check the files for viruses, we cannot guarantee that they are safe and clean. For your own protection always virus scan downloaded files for viruses, spyware and malware. We at FreeDownload64.com does not provide any torrent files, links to any file sharing sites including Rapidshare, YouSendIt, SendSpace, DepositFiles, etc. Software piracy is theft. All download links of listed software are direct full download from publishers sites or selected mirrors. Using crack, warez version, warez passwords, patches, serial numbers, registration codes, keymaker, key generator, keygen or pirate license key is illegal and prevent future software developments.
Categories
Top Downloads
New Downloads
- home|
- latest|
- popular|
- submit|
- bookmark|
- rss feeds|
- link to us|
- privacy|