c#의 StartsWith, EndsWith 함수

· 9년 전 · 2824

[code]

function startsWith($haystack, $needle) {
     $length = strlen($needle);
     return substr($haystack, 0, $length) === $needle;
}
[/code]

[code]

function endsWith($haystack, $needle) {
    $length = strlen($needle);
    if ($length == 0)
        return true;
    return substr($haystack, -$length) === $needle;

[/code] 

|

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기
🐛 버그신고