Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

데블스캠프2011/셋째날/String만들기: Difference between revisions

From ZeroWiki
imported>linflus
No edit summary
 
imported>enochbible
No edit summary
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
String str = new String("abcdef");
* 사용 언어 : C++


charAt
String str("abcdef");
str.charAt(3) == 'd'
String str2("abcb");
compareTo
String str3("        aB c  ");
{| class="wikitable"
|-
| 함수
| 예
|-
| charAt
| str.charAt(3) == 'd'
|-
| compareTo
| str2.compareTo("abcb") == 0
|-
| compareToIgnoreCase
| str2.compareTo("AbCb") == 0
|-
| concat
| str.concat(str) == "abcdefabcdef"
|-
| contains
| str.contains("bcd") == TRUE
|-
| endsWith
| str.endsWith("ef") == TRUE
|-
| startsWith
| str.startsWith("abc") == TRUE
|-
| equals
| str.equals(new String("abcdef")) == TRUE
|-
| equalsIgnoreCase
| str.equalsIgnoreCase(new String("ABcdEf")) == TRUE
|-
| indexOf
| str2.indexOf("b") == 1
|-
| isEmpty
| str.isEmpty == FALSE
|-
| lastIndexOf
| str2.lastIndexOf("b") == 3
|-
| length
| str.length() == 6
|-
| replace
| str.replace("bc", "ad") == "aaddef"
|-
| split
| str.split("c") == {"ab", "def"}
|-
| subString
| str.subString(2, 4) == "cd"
|-
| format
| String::format("참석자 : %d명", 8) == "참석자 : 8명"
|-
| trim
| str3.trim() == "aB c"
|-
| toLower
| str3.toLower() == "        ab c  "
|-
| toUpper
| str.toUpper() == "ABCDEF"
|-
| valueOf
| String::valueOf(3) == "3"
|}


compareToIgnoreCase
== 도전자 코드 ==
 
* [[데블스캠프2011/셋째날/String만들기/송지원]]
concat
* [[데블스캠프2011/셋째날/String만들기/김준석]]
str.concat(str) == "abcdefabcdef"
* [[데블스캠프2011/셋째날/String만들기/서지혜]]
contains
str.contains("bcd") == TRUE
endsWith
str.endsWith("ef") == TRUE
startsWith
str.startsWith("abc") == TRUE
equals
str.equals(new String("abcdef")) == TRUE
equalsIgnoreCase
str.equalsIgnoreCase(new String("ABcdEf")) == TRUE
indexOf
str.
isEmpty
lastIndexOf
length
replace
split
subString
 
format
trim
toLower
toUpper
 
valueOf



Latest revision as of 19:24, 30 June 2011

  • 사용 언어 : C++

String str("abcdef"); String str2("abcb"); String str3(" aB c ");

함수
charAt str.charAt(3) == 'd'
compareTo str2.compareTo("abcb") == 0
compareToIgnoreCase str2.compareTo("AbCb") == 0
concat str.concat(str) == "abcdefabcdef"
contains str.contains("bcd") == TRUE
endsWith str.endsWith("ef") == TRUE
startsWith str.startsWith("abc") == TRUE
equals str.equals(new String("abcdef")) == TRUE
equalsIgnoreCase str.equalsIgnoreCase(new String("ABcdEf")) == TRUE
indexOf str2.indexOf("b") == 1
isEmpty str.isEmpty == FALSE
lastIndexOf str2.lastIndexOf("b") == 3
length str.length() == 6
replace str.replace("bc", "ad") == "aaddef"
split str.split("c") == {"ab", "def"}
subString str.subString(2, 4) == "cd"
format String::format("참석자 : %d명", 8) == "참석자 : 8명"
trim str3.trim() == "aB c"
toLower str3.toLower() == " ab c "
toUpper str.toUpper() == "ABCDEF"
valueOf String::valueOf(3) == "3"

도전자 코드