ajun mukund


{ City }
< Country > india
* Profession *
User No # 104978
Total Questions Posted # 0
Total Answers Posted # 1

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 6
Users Marked my Answers as Wrong # 1
Questions / { ajun mukund }
Questions Answers Category Views Company eMail




Answers / { ajun mukund }

Question { 34136 }

How do you check whether a string is palindrome or not using TCL script?


Answer

set a "mumy"
set b [lindex $a 0]

set c [split $a ""]
set d [llength $c]
set e [expr $d -1]
for {set i $e} {$i >= 0} {incr i -1 } {
lappend new [lindex $c $i]
}
set f [join $new {}]
set g [string compare $a $f]
if {$g == 0} {
puts " $a is palindrome \n"
} else {
puts "$a is not palindrome\n";
}

Is This Answer Correct ?    6 Yes 1 No