가운데 글자 가져오기 Level 1 #substring #length(),length,size() 차이
·
프로그래밍/알고리즘(자바)
가운데 글자 가져오기 Level 1https://programmers.co.kr/learn/challenge_codes/82 length와 length(), size()들의 차이점은 아래 링크에 잘 설명 되어 있다. length와 length(), size()들의 차이점 즉 length는 배열, length()는 문자열, size는 콜렉션, 셋 객체에서 사용한다. class StringExercise{ String getMiddle(String word){ return word.substring((word.length()-1)/2,word.length()/2+1) ; //length()-1 후에 나누기 2 해야 함에 유의!! //subString이 아니라 substring이다. //substring(여기..