c#의 StartsWith, EndsWith 함수 > 개발자팁

개발자팁

개발과 관련된 유용한 정보를 공유하세요.
질문은 QA에서 해주시기 바랍니다.

c#의 StartsWith, EndsWith 함수 정보

PHP c#의 StartsWith, EndsWith 함수

본문


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

function endsWith($haystack, $needle) {
    $length = strlen($needle);
    if ($length == 0)
        return true;
    return substr($haystack, -$length) === $needle;
} 
 
추천
0
  • 복사

댓글 0개

© SIRSOFT
현재 페이지 제일 처음으로