Zuckerberg
Zuckerberg

Reputation: 205

How do I calculate number of letters in a word in Tcl

I am getting the answer as 1 I tried this :

set a "Amazon"
set b [split $a]
set c [llength $b]
puts "$c"

Upvotes: 0

Views: 1288

Answers (2)

Shyam Swaroop Nigam
Shyam Swaroop Nigam

Reputation: 1

set a "amazon"
set a [split "$a" ""]
puts [llength $a]

Upvotes: 0

Hai Vu
Hai Vu

Reputation: 40733

I believe you can use string length for that:

set a "Amazon"
set lengthOfA [string length $a]
puts "Length is: $lengthOfA"

Upvotes: 5

Related Questions