Skip to content

[문자열 덧셈 계산기] 이현제 미션 제출합니다.#125

Open
HyunjeLee wants to merge 15 commits intowoowacourse-precourse:mainfrom
HyunjeLee:HyunjeLee
Open

[문자열 덧셈 계산기] 이현제 미션 제출합니다.#125
HyunjeLee wants to merge 15 commits intowoowacourse-precourse:mainfrom
HyunjeLee:HyunjeLee

Conversation

@HyunjeLee
Copy link

@HyunjeLee HyunjeLee commented Oct 21, 2024

🥞 개요

구분자를 이용한 문자열 덧셈 계산기

📜 기능 목록

  • 사용자에게 입력 받는 기능
    • 사용자가 입력하는 값은 camp.nextstep.edu.missionutils.ConsolereadLine()을 활용한다.
  • 입력값을 구분자를 기준으로 숫자 추출 기능
  • 기본 구분자 외 커스텀 구분자 지정 기능
    • 기본 구분자 : ,, :
  • 추출된 숫자의 합 반환 기능
  • 잘못된 값에 대한 예외 발생 기능
    • 프로그램 종료 시 System.exit() 또는 exitProcess()를 호출하지 않는다.

✅ 점검사항

  • [$미션제목] $이름 미션 제출합니다. 형식의 제목 작성
    ex) [문자열 덧셈 계산기] 이현제 미션 제출합니다.

fun extractNumber(input: String): List<String> {
if (input == "") return listOf("0")

return input.substringAfter("\\n").split(*delimiter.toTypedArray())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* 이거는 한번도 사용 해본 적이 없었는데 덕분에 한 수 배워갑니다.

makeCustomDelimiter(input)
}

println("결과 : ${calculateSum(extractNumber(input))}")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지금은 이해하기 쉽지만, 이후 중첩이 늘어난다면 단번에 이해하기 어려울 거 같아요

HyunjeLee

This comment was marked as off-topic.

HyunjeLee

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants