"함수 substr count()"의 두 판 사이의 차이

 
(차이 없음)

2021년 4월 14일 (수) 18:54 기준 최신판


1 개요[ | ]

함수 substr_count()

2 Java[ | ]

import java.util.regex.Pattern;
public class MyClass {
    public static void main(String args[]) {
        String s = "This is a test";
        String sub = "is";
        int count = s.split(sub,-1).length-1;
        System.out.println( count ); // 2
    }
}

3 PHP[ | ]

echo substr_count('This is a test', 'is'); # 2
echo substr_count("Hello world. The world is nice","world"); # 2

4 Python[ | ]

s = "Hello world. The world is nice"
print( s.count("world") ) # 2

5 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}