반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- CMD
- 자바스크립트
- string
- Button
- 문자열
- javascript
- input
- IntelliJ
- 이클립스
- Eclipse
- json
- js
- date
- 테이블
- Java
- html
- 인텔리제이
- Visual Studio Code
- vscode
- 배열
- list
- ArrayList
- 이탈리아
- 정규식
- Maven
- Array
- table
- 자바
- windows
- CSS
Archives
- Today
- Total
목록character (1)
어제 오늘 내일
[Java] 문자열에서 특정 문자 개수 구하는 3가지 방법
Java 문자열에 포함된 특정 문자의 개수를 구하는 방법 3가지를 알아보도록 하겠습니다. 1. 반복문 이용하기 코드 public class CharCount { public static void main(String[] args) { String str = "apple"; System.out.println(countChar(str, 'a')); // 1 System.out.println(countChar(str, 'p')); // 2 System.out.println(countChar(str, 'l')); // 1 System.out.println(countChar(str, 'e')); // 1 System.out.println(countChar(str, 'c')); // 0 } public static..
IT/Java
2021. 4. 29. 06:36