Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
- Clojure
- C++
- C++
- C#
- C#
- D
- Dart
- Elixir
- Fortran
- Go
- Groovy
- Haskell
- JS
- Java
- Kotlin
- Lisp
- Lua
- PHP
- Pascal
- Perl
- Python
- Ruby
- Rust
- Scala
return suffix.size() == s.size() - s.rfind(suffix);
var _b = _s.EndsWith(_suffix);
bool b = s.EndsWith(suffix);
var b = s.endsWith(suffix);
b = String.ends_with?(s, suffix)
b = (s(len(s)-len(suffix)+1:) == suffix)
var b = s.endsWith(suffix);
ECMAScript 6 and above.
boolean b = s.endsWith(suffix);
(defun check-suffix (str suf )
(if (> (length suf) (length str )) nil (equalp (subseq str (- (length str) (length suf)) (length str )) suf )))
(setf b (check-suffix s suffix))
b = s:sub(-string.len(suffix)) == suffix
Implementation for non static suffix
$b = (bool)preg_match("/{$suffix}$/", $s);
Uses regular expression to check end of s for suffix
$b = $suffix eq substr($s, -length($suffix));
b = s.endswith(suffix)
val b = s.endsWith(suffix)