Skip to content

Commit

Permalink
숫자 문자열과 영 단어 - level1
Browse files Browse the repository at this point in the history
  • Loading branch information
sey2 authored Aug 15, 2022
1 parent 0c0ebae commit 244f029
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions programmers/IntStrAndEngWord.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import java.util.*;

class Solution {
public static int solution(String s) {
int answer = 0;
String numbers[] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};

for(int i=0; i<=9; i++)
s = s.replace(numbers[i], Integer.toString(i));

answer = Integer.parseInt(s);

return answer;
}
}

0 comments on commit 244f029

Please sign in to comment.