๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ’Ž/C++

[C++] string ๋ฉ”์†Œ๋“œ ์ •๋ฆฌ

by dar0m! 2020. 3. 17.

 

string.size()

 

string.length()

 

char string::at()

 

char c = string[0];

 

string.front()

= string.at(0)

string.back()

 

string.insert(์ถ”๊ฐ€ํ•  ์œ„์น˜, ๋ฌธ์ž์—ด)

 

string string::find()

 

string.clear()

void clear();

bool empty() const;

 

string substr (size_t pos, size_t len) const;

 

string::iterrator it;

 

string& string::erase (size_type pos)

pos ์ดํ›„๋กœ ์ „๋ถ€ ์‚ญ์ œ 2๋ฉด 3๋ถ€ํ„ฐ ์‚ญ์ œ.

 

string& string:: erase (iterator pos)

ํ•œ ๊ธ€์ž ์‚ญ์ œ

string& replace(size_t index, size_t len, const string& str)

index์œ„์น˜์—์„œ len๊ธธ์ด๊นŒ์ง€์˜ ๋ฒ”์œ„๋ฅผ ๋งค๊ฐœ๋ณ€์ˆ˜ str๋กœ ๋Œ€์ฒด

๋Œ“๊ธ€