Index
 
  Reference for Wiring 1.0 (ALPHA) 0017+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.
Name  

String

   
Examples  
String a = "CCCP"; 
char data[] = {'C', 'C', 'C', 'P'}; 
String b = String(data); 
 
Serial.println(a);  // Prints 'CCCP' to the Serial serial port 
Serial.println(b);  // Prints 'CCCP' to the Serial serial port 


char t[] = "A character string"; 
String a = String("hello");  
String b = String(" there"); 
String c = String(t); 
 
a += b; // a holds now 'hello there' equivalent to a.append(b) 
Serial.println(c);  // Prints 'A character string' to the Serial serial port 

Description   A string is a sequence of characters. The class String includes methods for examining individual characters, comparing strings, searching strings, extracting parts of strings, and for converting an entire string uppercase and lowercase. Strings are always defined inside double quotes ("Abc") and characters are always defined inside single quotes('A').

Note that the Wiring String class has differences with the processing or Java String class. The main difference is that some methods modify the actual string instead of returning a modified copy of it.

스트링은 문자의 연속입니다. 클래스 String은 개별적 문자를 검사, 문자열 비교, 문자열 검색, 문자열 일부 추출, 대문자 또는 소문자로의 변환을 포함합니다. 스트링은 언제나 더블쿼테이션 기호로 쌓입니다("Abc").  문자는 언제나 싱글 쿼테이션 기호로 쌓입니다('A').

   
Methods  
charAt()
  Returns the character at the specified index
지정한 위치의 문자를 반환합니다.
append()
  Appends the String representation of the argument specified

capacity()
  Returns the internal capacity of the String

contains()
  Returns true if there is an occurrence of the input string

getBytes()
  Returns an array of bytes containing the characters of the String as bytes
스트링을 바이트 단위로 계산하여 반환합니다.
setCharAt()
  Changes the character specified at the specified index
지정한 위치에 문자를 변경합니다.
endsWith()
  Returns true if the current string ends with the input string

equals()
  Compares a string to a specified object
지정한 개체와 스트링을 비교합니다.
indexOf()
  Returns the index value of the first occurrence of a character within the input string
입력 스트링에서 처음으로 일치하는 문자의 위치를 반환합니다.
length()
  Returns the number of characters in the input string
입력 스트링의 수를 반환합니다.
replace()
  Replaces all the occurrences of a character in a string with the specified character

스트링에서 지정한 문자와 일치하면 대체합니다.
startsWith()
  Returns true if the current string starts with the input string

substring()
  Returns a new string that is part of the input string

toCharArray()
  Returns the content of the specified String as an array of chars

toLowerCase()
  Converts all the characters to lower case
모든 문자를 소문자로 변환합니다.
toUpperCase()
  Converts all the characters to upper case
모든 문자를 대문자로 변환합니다.
   
   
Constructors  
String(data)
   
Parameters  
data   byte[], char[]: array of bytes to be decoded into characters or array of characters to be combined into a string, int: empty string with the specified initial capacity, String: string to be copied into the created string


   
Usage   Web & Application
   
Related   char