Hello !

· Java
try-with-resources는 try에 자원 객체를 전달하면, try 코드 블록이 끝나면 자동으로 자원을 종료해주는 기능이다. // 기존 코드 try{ Stream lineStream = Files.lines(Paths.get("file.txt"), StandardCharsets.UTF_8); System.out.println(Arrays.toString(lineStream.toArray())); }catch (IOException e){ e.printStackTrace(); } // try - with - resources try( Stream lineStream = Files.lines(Paths.get("file.txt"),StandardCharsets.UTF_8)) { System.out.p..
· JavaScript
더보기 Flag Meaning Description i Ignore Case 대소문자를 구별하지 않고 검색한다. g Global 문자열 내의 모든 패턴을 검색한다. m Multi Line 문자열의 행이 바뀌더라도 검색을 계속한다. s ​ .​(모든 문자 정규식)이 개행 문자 \n도 포함하도록 u unicode 유니코드 전체를 지원 y sticky 문자 내 특정 위치에서 검색을 진행하는 ‘sticky’ 모드를 활성화 a-zA-Z 영어알파벳(-으로 범위 지정) ㄱ-ㅎ가-힣 한글 문자(-으로 범위 지정) 0-9 숫자(-으로 범위 지정) . 모든 문자열(숫자, 한글, 영어, 특수기호, 공백 모두) 단, 줄바꿈 X \d 숫자 \D 숫자가 아닌 것 \w 밑줄 문자를 포함한 영숫자 문자에 대응 [A-Za-z0-9_]..
· Java
import java.util.Calendar; public class AgeTest { public static void main(String[] args) { System.out.println(getAge("220830") + "살"); } public static int getAge(String birth) { Calendar current = Calendar.getInstance(); int currentYear = current.get(Calendar.YEAR); int currentMonth = current.get(Calendar.MONTH) + 1; int currentDay = current.get(Calendar.DAY_OF_MONTH); int yearForCalculation = I..
input 으로 받은 file의 이름을 고정적으로 바꿔야 되는 일이 있었다. let formData = new FormData(); const fileInput = document.getElementById(inputId); const files = fileInput.files; const changeName = 'changeName'; for (var i = 0; i < files.length; i++) { let oldFile = files[i]; //기존 파일 let newFile = null; //바뀐 이름 파일 let exp = files[i].name.split('.')[1]; // 파일확장자 if(inputId == 'file_0'){ // new File( 기존이름 , 바뀔이름 ) newF..
mart3n
시골 외양간 개발자