Implementation
Java

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
const n = s.length;
import "unicode/utf8"
n := utf8.RuneCountInString(s)
n = s.length
uses LazUtf8;
n := length(s);
int n = s.length;
n = s.size
uses LazUtf8;
n := Utf8Length(s);
size_t n = s.length;
std.range;
size_t n = s.walkLength;
import std.uni, std.range;
size_t n = s.byGrapheme.walkLength;
n = len(s)
n = length s
uses sysutils;
n := s.length;
n = String.length s
local n = utf8.len(s)
let n = s.chars().count();
my $n = length( $s );
$n = mb_strlen($s, 'UTF-8');
int n = s.Length;
val n = s.length()
#include <string>
auto n = s.size();
(setf n (length s))
(length s)
(def n (.codePointCount s 0 (count s)))
#include <stdlib.h>
size_t	ft_strlen(const char *str)
{
	int	count;

	count = 0;
	while (str[count])
		count++;
	return (count);
}
n = len(s)
#include <iterator>
#include <string>
int n = std::distance(str.begin(), str.end());
val n = s.length
N = string:length(S)
IDENTIFICATION DIVISION.
PROGRAM-ID. length.
PROCEDURE DIVISION.
   MOVE FUNCTION LENGTH(s) TO n
STOP RUN.
s : String := "Hello World";
n : Integer := s'Length;
Dim s As String = "1234567"
Dim n As Integer = s.Length