Skip to content

Commit d1d0649

Browse files
authored
Merge pull request #368 from per1234/revert-string-capitalization
Revert incorrect capitalizations in string reference page
2 parents 50d5f84 + d27c313 commit d1d0649

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

Language/Variables/Data Types/String.adoc renamed to Language/Variables/Data Types/string.adoc

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: String
2+
title: string
33
categories: [ "Variables" ]
44
subCategories: [ "Data Types" ]
55
---
@@ -17,12 +17,12 @@ subCategories: [ "Data Types" ]
1717

1818
[float]
1919
=== Description
20-
Text Strings can be represented in two ways. you can use the String data type, which is part of the core as of version 0019, or you can make a String out of an array of type char and null-terminate it. This page described the latter method. For more details on the String object, which gives you more functionality at the cost of more memory, see the link:../stringobject[String object] page.
20+
Text strings can be represented in two ways. you can use the String data type, which is part of the core as of version 0019, or you can make a string out of an array of type char and null-terminate it. This page described the latter method. For more details on the String object, which gives you more functionality at the cost of more memory, see the link:../stringobject[String object] page.
2121
[%hardbreaks]
2222

2323
[float]
2424
=== Syntax
25-
All of the following are valid declarations for Strings.
25+
All of the following are valid declarations for strings.
2626

2727
`char Str1[15];` +
2828
`char Str2[8] = {'a', 'r', 'd', 'u', 'i', 'n', 'o'};` +
@@ -31,30 +31,30 @@ All of the following are valid declarations for Strings.
3131
`char Str5[8] = "arduino";` +
3232
`char Str6[15] = "arduino";`
3333

34-
*Possibilities for declaring Strings*
34+
*Possibilities for declaring strings*
3535

3636
* Declare an array of chars without initializing it as in Str1
3737
* Declare an array of chars (with one extra char) and the compiler will add the required null character, as in Str2
3838
* Explicitly add the null character, Str3
39-
* Initialize with a String constant in quotation marks; the compiler will size the array to fit the String constant and a terminating null character, Str4
40-
* Initialize the array with an explicit size and String constant, Str5
41-
* Initialize the array, leaving extra space for a larger String, Str6
39+
* Initialize with a string constant in quotation marks; the compiler will size the array to fit the string constant and a terminating null character, Str4
40+
* Initialize the array with an explicit size and string constant, Str5
41+
* Initialize the array, leaving extra space for a larger string, Str6
4242

4343
*Null termination*
4444

45-
Generally, Strings are terminated with a null character (ASCII code 0). This allows functions (like `Serial.print()`) to tell where the end of a String is. Otherwise, they would continue reading subsequent bytes of memory that aren't actually part of the String.
45+
Generally, strings are terminated with a null character (ASCII code 0). This allows functions (like `Serial.print()`) to tell where the end of a string is. Otherwise, they would continue reading subsequent bytes of memory that aren't actually part of the string.
4646

47-
This means that your String needs to have space for one more character than the text you want it to contain. That is why Str2 and Str5 need to be eight characters, even though "arduino" is only seven - the last position is automatically filled with a null character. Str4 will be automatically sized to eight characters, one for the extra null. In Str3, we've explicitly included the null character (written '\0') ourselves.
47+
This means that your string needs to have space for one more character than the text you want it to contain. That is why Str2 and Str5 need to be eight characters, even though "arduino" is only seven - the last position is automatically filled with a null character. Str4 will be automatically sized to eight characters, one for the extra null. In Str3, we've explicitly included the null character (written '\0') ourselves.
4848

49-
Note that it's possible to have a String without a final null character (e.g. if you had specified the length of Str2 as seven instead of eight). This will break most functions that use Strings, so you shouldn't do it intentionally. If you notice something behaving strangely (operating on characters not in the String), however, this could be the problem.
49+
Note that it's possible to have a string without a final null character (e.g. if you had specified the length of Str2 as seven instead of eight). This will break most functions that use strings, so you shouldn't do it intentionally. If you notice something behaving strangely (operating on characters not in the string), however, this could be the problem.
5050

5151
*Single quotes or double quotes?*
5252

5353
Strings are always defined inside double quotes ("Abc") and characters are always defined inside single quotes('A').
5454

55-
*Wrapping long Strings*
55+
*Wrapping long strings*
5656

57-
You can wrap long Strings like this:
57+
You can wrap long strings like this:
5858

5959
[source,arduino]
6060
----
@@ -63,9 +63,9 @@ char myString[] = "This is the first line"
6363
" etcetera";
6464
----
6565

66-
*Arrays of Strings*
66+
*Arrays of strings*
6767

68-
It is often convenient, when working with large amounts of text, such as a project with an LCD display, to setup an array of Strings. Because Strings themselves are arrays, this is in actually an example of a two-dimensional array.
68+
It is often convenient, when working with large amounts of text, such as a project with an LCD display, to setup an array of strings. Because strings themselves are arrays, this is in actually an example of a two-dimensional array.
6969

7070
In the code below, the asterisk after the datatype `char` "`char*`" indicates that this is an array of "`pointers`". All array names are actually pointers, so this is required to make an array of arrays. Pointers are one of the more esoteric parts of C for beginners to understand, but it isn't necessary to understand pointers in detail to use them effectively here.
7171

@@ -86,8 +86,8 @@ In the code below, the asterisk after the datatype `char` "`char*`" indicates th
8686

8787
[source,arduino]
8888
----
89-
char* myStrings[]={"This is String 1", "This is String 2", "This is String 3",
90-
"This is String 4", "This is String 5","This is String 6"};
89+
char* myStrings[]={"This is string 1", "This is string 2", "This is string 3",
90+
"This is string 4", "This is string 5","This is string 6"};
9191
9292
void setup(){
9393
Serial.begin(9600);

0 commit comments

Comments
 (0)