- npm버전확인
- 우분투 node js 설치
- java 숫자를 문자로 변환하기
- node js express install
- 디지털오션 클라우드서버 생성하기
- ubuntu node js
- 파이썬
- 라즈베리파이4
- mysql index 생성
- c언어 파일 읽기
- 파이썬 반복문
- c file read
- 우분투 시간설정
- Ubuntu timezone
- 클라우드서버 생성
- 디지털오션 서버생성하기
- 자바 한줄씩 읽기
- index 생성
- tzselect
- express install
- ubuntu node js install
- Python
- 우분투 시간변경
- raspi-config
- node js 버전확인
- 디지털오션 드로플릿
- node 버전확인
- Node.js express install
- C언어
- 자바 파일 한줄씩 읽기
- Today
- Total
목록Java (9)
호그래머
1. 자바에스 텍스트파일 한줄씩 읽기 try{ File file = new File("C:\\Users\\HO\\Desktop\\test.txt"); FileReader filereader = new FileReader(file); BufferedReader bufReader = new BufferedReader(filereader); String line = ""; while((line = bufReader.readLine()) != null){ System.out.println(line); } bufReader.close(); }catch (FileNotFoundException e) { e.printStackTrace(); }catch(IOException e){ e.printStackTrace()..

1. 자바에서 ArrayList 사용하기 ArrayList al_car_no = new ArrayList(); al_car_no.add("경기12가1234"); al_car_no.add("서울12나4567"); al_car_no.add("강원12다8912"); System.out.println("ArrayList 사이즈:"+al_car_no.size()); System.out.println("0번지:"+al_car_no.get(0)); System.out.println("1번지:"+al_car_no.get(1)); System.out.println("2번지:"+al_car_no.get(2)); 결과
1. 자바에서 숫자를 문자로 변환하기 int i_age=98; String s_age=String.valueOf(i_age);
1. 자바 문자열 한글체크 하기 - regex import java.util.regex.Pattern; import java.util.regex.Matcher; public class tistory_java_230614 { public static void main(String[] args) { String text = "가나AA다1234"; String regex = "[\\p{IsHangul}]+"; Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(text); if (matcher.find()) { System.out.println("문자열에 한글 있음."); } else { System.out.println("문..
1. 자바 문자열 앞,뒤 공백(space) 제거 - trim() String Car_No=" 서울12가1234 "; System.out.println("1.차량번호는"+Car_No+"입니다."); Car_No=Car_No.trim(); System.out.println("2.차량번호는"+Car_No+"입니다."); 결과 1.차량번호는 서울12가1234 입니다. 2.차량번호는서울12가1234입니다. 차량번호 앞뒤 공백(space)가 제거됨 끝 1. 자바에서 쉽게 문자열 앞,뒤 공백(space)을 제거할 수 있습니다.
1. 자바 폴더 만들기 import java.io.File; public class tistory_create_directory { public static void main(String[] args) { String make_dir_path = "C:\\Users\\HO\\Desktop\\new_forder"; File make_dir = new File(make_dir_path); make_dir.mkdir(); if(!make_dir.exists()) { try { make_dir.mkdir(); System.out.println("폴더생성"); }catch(Exception e) { e.printStackTrace(); } }else { System.out.println("폴더가 이미 존재함");..
1. 자바 날짜 구하기 (Date) Date 객체 사용 import java.util.date 필요 import java.util.Date; public class tistory_date_time { public static void main(String[] args) { Date today = new Date(); System.out.println(today); } } 출력 Mon Jan 04 22:58:31 KST 2021 2. 자바 날짜 표현방법(SimpleDateFormat) Date 객체와 SimpleDateFormat 사용으로 표현방법 변경 import java.text.SimpleDateFormat 필요 new SimpleDateFormat("패턴"); 원하는 날짜 시간 패턴으로 설정 imp..

1. 자바 문자열 자르기(substring) 문자열.substring(int beginindex, int endindex); beginindex는 자르는 시작 위치(beginindex에서 시작) endindex는 자르는 끝 위치(endindex까지 자름) beginindex와endindex는 정수 문자열의 시작은 0 부터 String today_datetime = "2020년11월19일15시30분25초"; String today_date = today_datetime.substring(0,11); String today_time = today_datetime.substring(11,20); today_date : 2020년11월19일 today_time : 15시30분25초 2. 자바 문자열 나누기(sp..
1. 자바 문자를 정수로 형변환 (String to int) String number_string = "3355"; int number = Interger.parseInt(number_string); 2. 자바 정수를 문자로 형변환 (int to String) int number = 3355; String number_String = String.valueOf(number); 끝 1. 자바에서 간단하게 문자 -> 정수, 정수 -> 문자로 형변환 할 수 있습니다. 2. 문자에서 정수형으로 형변환 할 경우 숫자인 문자열(number string)만 변환 가능 합니다.