String Character Length: Difference between revisions

verified that AWK example only does byte length
No edit summary
(verified that AWK example only does byte length)
Line 25:
Or:
count "Hello World"
 
=={{header|AWK}}==
From within any code block:
w=length("Hello, world!") # static string example
x=length("Hello," s " world!") # dynamic string example
y=length($1) # input field example
z=length(s) # variable name example
Ad hoc program from command line:
echo "Hello, world!" | awk '{print length($0)}'
From executable script: (prints for every line arriving on stdin)
#!/usr/bin/awk -f
{print"The length of this line is "length($0)}
 
=={{header|C}}==
Anonymous user