함수 strlen()

len
length
strlen

1 Bash[ | ]

LENGTH=`expr length "hello"`
echo $LENGTH
# 5

2 C[ | ]

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

3 C++[ | ]

C++ 스타일
#include <iostream>
#include <string>
using namespace std;
int main() {
    string s = "abc";
    cout << s.length() << endl; // 3
}
C 스타일
#include <iostream>
#include <cstring>
using namespace std;
int main() {
	cout << strlen("abc") << endl; // 3
}
#include <stdio.h>
#include <string.h>
int main() {
    printf("%d", strlen("abc")); // 3
}

4 C#[ | ]

"hello".Length;      // returns 5
"".Length;           // returns 0

5 Erlang[ | ]

string:len("hello"). %  returns 5
string:len("").      %  returns 0

6 Java[ | ]

"hello".length()   // returns 5
"".length()        // returns 0

7 JavaScript[ | ]

document.write( "Hello World!".length ); // 12

8 Kotlin[ | ]

fun main(args: Array<String>) {
    println("Hello World!".length)
    // 12
}

9 Lua[ | ]

("hello"):len() -- returns 5
#"" -- returns 0

10 Objective-C[ | ]

[@"hello" length]   // returns 5
[@"" length]        // returns 0

11 Perl[ | ]

length("hello");     #  returns 5
length("");          #  returns 0

12 PHP[ | ]

strlen('hello');     //  returns 5
strlen('');          //  returns 0

13 Python[ | ]

len('hello')     #  returns 5
len('')          #  returns 0

14 R[ | ]

nchar("hello")
## [1] 5
nchar("")
## [1] 0

15 Ruby[ | ]

'hello'.length     #  returns 5
''.length          #  returns 0

16 SQL[ | ]

16.1 MySQL[ | ]

SELECT LENGTH( "hello" )
-- 5

17 VB[ | ]

Len("hello")         '  returns 5
Len("")              '  returns 0

18 같이 보기[ | ]