๋ณธ ๊ณผ์ ์์๋ ์ด์ ๊ณผ์ ์ ์ด์ด์ string ๋ค๋ฃจ๋ ๋ฐฉ๋ฒ์ ํ์ตํฉ๋๋ค. ๋ค๋ฅธ ์๋ฃ๊ตฌ์กฐ๋ฅผ ํ์์์ ์ฌ์ฉํ์๋ฉด ๋ฉ๋๋ค. ๋ณธ ๊ณผ์ ์์ ํ์ด์ผ ํ ๋ฌธ์ ๋ ์๋ 2๊ฐ์ง๊ฐ ์์ต๋๋ค.
- ์๋๋งํฌ๋ฅผ ํด๋ฆญํ์ฌ ์์ github repository๋ฅผ ๋ณต์ฌํจ
- ์๋ ์ฝ๋๋ฅผ ์ฌ์ฉํ์ฌ ์์ ์ฝ๋ github repository๋ฅผ ์์ ์ ์ปดํจํฐ๋ก ํด๋ก ํจ
git clone <๋ ํฌ์งํ ๋ฆฌ URL>
- ํด๋น ํด๋๋ก ์ด๋ํ์ฌ ์์ ์ ์ฝ๋๋ฅผ ์์ ํจ
- digits_to_words
์ธํ์ผ๋ก ๋ฐ๋ ์คํธ๋ง์์ ์ซ์๋ง ์ถ์ถํ์ฌ ์์ด ๋จ์ด๋ก ๋ณํํ์ฌ ๋จ์ด๋ค์ด ์ฐ๊ฒฐ๋ ์คํธ๋ง์ ๋ฐํํจ
์๋์ ์๊ฑด๋ค์ ์ถฉ์กฑ์์ผ์ผํจ
* ๋ฐํํ๋ ๋จ์ด๋ค์ ์์ด ์๋ฌธ์์ฌ์ผํจ
* ๋จ์ด๋ค ์ฌ์ด์๋ ๋์ด์ฐ๊ธฐ ํ์นธ์ด ์์
* ๋ง์ฝ ์ธํ ์คํธ๋ง์์ ์ซ์๊ฐ ์กด์ฌํ์ง ์๋ ๋ค๋ฉด, ๋น ๋ฌธ์์ด (empty string)์ ๋ฐํํจ
Parameters:
input_string (string): ์์ด๋ก ๋ ๋๋ฌธ์, ์๋ฌธ์, ๋์ด์ฐ๊ธฐ, ๋ฌธ์ฅ๋ถํธ, ์ซ์๋ก ์ด๋ฃจ์ด์ง string
ex - "Zip Code: 19104"
Returns:
digit_string (string): ์ ์๊ฑด์ ์ถฉ์กฑ์ํจ ์ซ์๋ง ์์ด๋จ์ด๋ก ์ถ์ถ๋ string
ex - 'one nine one zero four'
Examples:
>>> import text_processing2 as tp2
>>> digits_str1 = "Zip Code: 19104"
>>> tp2.digits_to_words(digits_str1)
'one nine one zero four'
>>> digits_str2 = "Pi is 3.1415..."
>>> tp2.digits_to_words(digits_str2)
'three one four one five'
- to_camel_case
์ปดํจํฐ ํ๋ก๊ทธ๋๋ฐ์ ๋ง์ ๋ช
๋ช
๊ท์น์ด ์์ง๋ง, ๋ ๊ท์น์ด ํนํ ํํ ์ฐ์
๋๋ค.
์ฒซ๋ฒ์งธ๋ก๋, ๋ณ์ ์ด๋ฆ์ 'underscore'๋ก ๋๋ ์ค๋ค๊ฑฐ๋, (ex. under_score_variable)
๋๋ฒ์งธ๋ก๋, ๋ณ์ ์ด๋ฆ์ ๋์๋ฌธ์ ๊ตฌ๋ณํด ๊ตฌ๋ถ์ (delimiter)์์ด ์ฐ๋ ๊ฒฝ์ฐ๊ฐ ์์ต๋๋ค.
์ด ๋๋ฒ์งธ์ ๊ฒฝ์ฐ์๋ ์ฒซ๋ฒ์งธ ๋จ์ด๋ ์๋ฌธ์๋ก, ๊ทธ ํ์ ์ค๋ ๋จ์ด๋ค์ ์ฒซ๋ฒ์งธ ๊ธ์๋ค์ ๋๋ฌธ์๋ก ์ฐ์
๋๋ค (ex. camelCaseVariable).
์ด ๋ฌธ์ ์์ ์ฒซ๋ฒ์งธ ๊ท์น 'underscore variable' ์์ ๋๋ฒ์งธ ๊ท์น 'camelcase variable'์ผ๋ก ๋ณํํจ
* ์๊ณผ ๋ค์ ์ฌ๋ฌ๊ฐ์ 'underscore'๋ ๋ฌด์ํด๋ ๋
* ๋ง์ฝ ์ด๋ค ๋ณ์ ์ด๋ฆ์ด underscore๋ก๋ง ์ด๋ฃจ์ด ์ง๋ค๋ฉด, ๋น ๋ฌธ์์ด๋ง ๋ฐํํด๋ ๋จ
Parameters:
underscore_str (string): underscore case๋ฅผ ๋ฐ๋ฅธ ์คํธ๋ง
Returns:
camelcase_str (string): camelcase๋ฅผ ๋ฐ๋ฅธ ์คํธ๋ง
Examples:
>>> import text_processing2 as tp2
>>> underscore_str1 = "to_camel_case"
>>> tp2.to_camel_case(underscore_str1)
'toCamelCase'
>>> underscore_str2 = "__EXAMPLE__NAME__"
>>> tp2.to_camel_case(underscore_str2)
'exampleName'
