6
Java 문자열에서 선행 및 후행 공백 제거
Java 문자열에서 선행 또는 후행 공백을 제거하는 편리한 방법이 있습니까? 다음과 같은 것 : String myString = " keep this "; String stripppedString = myString.strip(); System.out.println("no spaces:" + strippedString); 결과: no spaces:keep this myString.replace(" ","") keep과 this 사이의 공간을 대체합니다.