Get length of string

Contents

Output

5


Code examples


JavaScript

let str = "A-B-C";
console.log(str.length);

Perl

my $str = "A-B-C";
print length($str)."\n";

PHP

<?php
$str = "A-B-C";
print strlen($str)."\n";

Python

example = "A-B-C"
print(str(len(example)))

Ruby

str = "A-B-C";
print(str.length.to_s + "\n")