- len
- length
- strlen
1 Bash[ | ]
Bash
Copy
LENGTH=`expr length "hello"`
echo $LENGTH
# 5
2 C[ | ]

C
Copy
#include <stdio.h>
#include <string.h>
int main() {
printf("%d", strlen("abc")); // 3
}
3 C++[ | ]

C++ 스타일
C++
Copy
#include <iostream>
#include <string>
using namespace std;
int main() {
string s = "abc";
cout << s.length() << endl; // 3
}
C 스타일
C++
Copy
#include <iostream>
#include <cstring>
using namespace std;
int main() {
cout << strlen("abc") << endl; // 3
}
C
Copy
#include <stdio.h>
#include <string.h>
int main() {
printf("%d", strlen("abc")); // 3
}
4 C#[ | ]
C#
Copy
"hello".Length; // returns 5
"".Length; // returns 0
5 Erlang[ | ]
text
Copy
string:len("hello"). % returns 5
string:len(""). % returns 0
6 Java[ | ]
Java
Copy
"hello".length() // returns 5
"".length() // returns 0
7 JavaScript[ | ]
JavaScript
Copy
document.write( "Hello World!".length ); // 12
8 Kotlin[ | ]

Kotlin
Copy
fun main(args: Array<String>) {
println("Hello World!".length)
// 12
}
9 Lua[ | ]
lua
Copy
("hello"):len() -- returns 5
#"" -- returns 0
10 Objective-C[ | ]
Objective-C
Copy
[@"hello" length] // returns 5
[@"" length] // returns 0
11 Perl[ | ]
Perl
Copy
length("hello"); # returns 5
length(""); # returns 0
12 PHP[ | ]

PHP
Copy
strlen('hello'); // returns 5
strlen(''); // returns 0
13 Python[ | ]
Python
Copy
len('hello') # returns 5
len('') # returns 0
14 R[ | ]

R
Copy
nchar("hello")
## [1] 5
nchar("")
## [1] 0
15 Ruby[ | ]
Ruby
Copy
'hello'.length # returns 5
''.length # returns 0
16 SQL[ | ]
16.1 MySQL[ | ]
sql
Copy
SELECT LENGTH( "hello" )
-- 5
17 VB[ | ]
vbnet
Copy
Len("hello") ' returns 5
Len("") ' returns 0