Notice
Recent Posts
Recent Comments
Link
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- app router emotion
- ์๋ฐ์คํฌ๋ฆฝํธ ๋ฌธ์์ด ์์ถ
- suspense ๋น๋๊ธฐ
- next13 emotion
- suspense react-query
- ๊ตฌ๋ฆํค
- ๋ฆฌ์กํธ์ฟผ๋ฆฌ suspense
- ํ๋ก๊ทธ๋๋จธ์ค ๋ฌธ์์ด ์์ถ
- ์ฌ์ฉ์ฑ ๊ฐ์
- ๋ฐฑ์ค 2108 ์๋ฐ์คํฌ๋ฆฝํธ
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง
- js
- ํ๋ก๊ทธ๋๋จธ์ค ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- suspense ๋์์๋ฆฌ
- ๊ตฌ๋ฆํค ์ฑ๋ฆฐ์ง ํ๊ณ
- emotion RSC
- emtion app router
- ์ต์ ๋์ฒด์ด๋
- ๋ฐฑ์ค 2108 nodejs
- js ์ค์ฝํ
- js ๋ฌธ์์ด ์์ถ
- suspense ๋ณ๋ชฉํ์
- ์นด์นด์ค ์ฝํ
- ๋ฐฑ์ค 1339๋ฒ nodejs
- js ๊ฑฐ๋ฆฌ๋๊ธฐ ํ์ธํ๊ธฐ
- TypeError: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more:
- ๋ฐฑ์ค 1339๋ฒ ์๋ฐ์คํฌ๋ฆฝํธ
- ์๋ฐ์คํฌ๋ฆฝํธ ์ค์ฝํ
- ์ค์ฝํ
- ๋ฐฑ์ค 1339๋ฒ js
Archives
- Today
- Total
Lennon FE
[ํ๋ก๊ทธ๋๋จธ์ค] ์ ๊ท ์์ด๋ ์ถ์ฒ (js) ๋ณธ๋ฌธ
๐ฅ Algorithm/Programmers
[ํ๋ก๊ทธ๋๋จธ์ค] ์ ๊ท ์์ด๋ ์ถ์ฒ (js)
Lennon 2021. 11. 5. 16:04728x90
๋ฐ์ํ
https://programmers.co.kr/learn/courses/30/lessons/72410?language=javascript
function solution(new_id) {
let answer = new_id.toLowerCase();
answer = answer.replace(/[^\w-._]+/gi,'')
.replace(/\.\.+/g,'.')
.replace(/\.$/g,'')
.replace(/^\./g,'');
if(answer[0] === ".") answer.splice(0,1);
if(answer.length === 0) answer += 'a';
if(answer.length > 15) answer = answer.slice(0,15);
else if(answer.length <= 2) while(answer.length < 3) answer += answer[answer.length - 1];
answer = answer.replace(/\.$/g,'');
return answer;
}
๋ฌธ์ ์์ ์๋ ค์ฃผ๋ ์์๋๋ก ์ฒ๋ฆฌํ๋ฉด ๋๋ค.
์ฒ์์ 2๋ฒ์กฐ๊ฑด์ ํด๊ฒฐํ๊ธฐ์ํด abcdef... 12345...-,_,. ๋ฑ์ ์ ์ธํด์ for๋ฌธ์ ๋๋ ธ๋๋ฐ ์ ๊ท์์ผ๋ก ํ๋ฉด ๋ ๊น๋ํ ๊ฒ ๊ฐ์ ์ ๊ท์์ ์ฌ์ฉํ๋ค.
๋๋จธ์ง ๊ทธ๋ฅ ๋จ๊ณ๋ณ๋ก ํ๋ผ๋๋๋ก ํ๋ฉด ๋๋ค.
728x90
๋ฐ์ํ
'๐ฅ Algorithm > Programmers' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค] ๋ฐฉ๋ฌธ ๊ธธ์ด (js) (0) | 2021.11.08 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค] ์คํฌํธ๋ฆฌ (js) (0) | 2021.11.07 |
[ํ๋ก๊ทธ๋๋จธ์ค] ๊ดํธ ๋ณํ (js) (0) | 2021.11.04 |
[ํ๋ก๊ทธ๋๋จธ์ค] ๋ฌธ์์ด ์์ถ (js) (0) | 2021.11.03 |
[ํ๋ก๊ทธ๋๋จธ์ค] ์์ด ๋๋ง์๊ธฐ (js) (0) | 2021.11.02 |
Comments