Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Twitter

tcl

set rjrj "RJ Ayu live@Jakarta"
set nick "hun"
set argv "met malam jeeee @indonesia"
set chan "#Radio"
    regsub -nocase -all " " $argv "+" argv
#putserv "PRIVMSG $chan :$nick say: $argv+($rjnow)+$chan+#Pesan+#Greet"
    set args_msg "$nick+say:+$argv+($rjrj)+#IndoGaul+#Pesan+#Greet"
#putserv "PRIVMSG $chan :$args_msg"
    regsub -nocase -all "#" $args_msg "%23" twitsquery
    regsub -nocase -all "@" $twitsquery "\[@\]" twitsquery
    set twit(surl) "https://anginku.com/twitter/?isinya=$twitsquery"
    puts "$twit(surl)"
#putserv "PRIVMSG hun :$twit(surl)"
#http::config -useragent mozilla
#set urltok [http::geturl $twit(surl) -timeout 20000]
#set twit(rpage) [http::data $urltok]
#http::cleanup $urltok
#regexp -line -- {created_at(.*)+0000} $twit(rpage) -> twit(zip)
#puts "uploaded $twit(zip)"

Tcl Hello World

tcl

puts "Hello World!"

proc try {a {b 3}} {
    puts "in Try, the a is $a"  
    set a [expr $b * 2]
    return "The a is $a and b is $b"
}

set msg [try 4]
# set msg "I am the one!"
puts $msg

set A(a) "V1"
set A(b) "V2"
set A(c) "V3"

foreach {k v} [array get A] {
    puts "key : $k ; val : $v"
}

puts [array names A]
# puts [keys $A]
puts [array get A]
puts [array size A]

array set A1 {aa 0 bb 1 cc 20}
foreach {k v} [array get A1] {
    puts "key : $k ; val : $v"
}



Execute Tcl Online

tcl

set ns [new Simulator]
set nf [open main.nam w]
$ns namtrace-all $nf
set nd [open main.tr w]
$ns trace-all $nd
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
$ns duplex-link $n0 $n1 1Mb 10ms DropTail
$ns duplex-link $n1 $n2 512Kb 10ms DropTail
$ns queue-limit $n1 $n2 5
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.005
$cbr0 attach-agent $udp0
set sink [new Agent/Null]
$ns attach-agent $n2 $sink
$ns connect $udp0 $sink
proc finish { } {
global ns nf nd
$ns flush-trace
close $nf
close $nd
exec nam main.nam &
exit 0
}
$ns at 0.2 "$cbr0 start"
$ns at 4.5 "$cbr0 stop"
$ns at 5.0 "finish"
$ns run

Execute Tcl Online

tcl

puts "Truth Table based Gate Level Simulator"
# boolean equation provided as input and displays it
puts -nonewline "Enter a boolean expression: "
flush stdout
set exp [gets stdin]
puts $exp
set variables [lsort -unique [regexp -inline -all {\$\w+} $exp]]
set length [llength $variables]
# differentiating among the variables as hey can be present number of times
set command [list format [string repeat "%s\t" $length]%s]
append command " {*}\[[list subst $variables]\] \[[list expr $exp]\]" 
set command "puts \[$command\]"
#calculates the value for each input combinations 
foreach v [lreverse $variables] {
set command [list foreach [string range $v 1 end] {0 1} $command]
}
#displays the output
puts " "
puts [join $variables \t]\tResult
apply [list {} $command]

prime number between 1-100

tcl

#!/usr/bin/tclsh

 for {set x 2} {$x<100} {incr x} {
    set flag 1
    for {set i 2} {$i<$x} {incr i} {
        set y [expr $x % $i]
        if {$y == 0}  {
            #puts "$x: not a prime no"
            set flag 0
            break   
        }
    }

    if {$flag ==1} {
        puts "$x: prime no"
    }
}

Execute Tcl Online

tcl

foreach d [list 1 2 3 4] e [list 5 6 7 8] f [list 9 10 12 11]   {
puts " $d $e $f "
};

Execute Tcl Online

tcl

# Set Main display
# wm minsize . 40 10
# wm title . "Email System Interface, v0"

frame .menubar
menubutton .menubar.file -text File -menu .menubar.file.f
menubutton .menubar.help -text Help -menu .menubar.help.h

pack .menubar -fill x
pack .menubar.file .menubar.help -side left


set f [menu .menubar.file.f]

#Create menu
$f add cascade -label Open 
# -menu $f.sub0
$f add cascade -label Save 
# -menu $f.sub1
$f add cascade -label Quit -command exit

set h [menu .menubar.help.h]
$h add cascade -label Search  
$h add cascade -label Support 

frame .body
label .body.to_label   -text "To:"
entry .body.to
label .body.from_label -text "From:"
entry .body.from 
label .body.sj_label   -text "Subject:"
entry .body.sj 
text  .body.t          -yscrollcommand {.body.s set}
scrollbar .body.s      -command {.body.t yview}

grid  .body.to_label   -row 0 -column 0 -sticky e
grid  .body.to	       -row 0 -column 1 -sticky ew
grid  .body.from_label -row 1 -column 0 -sticky e
grid  .body.from       -row 1 -column 1 -sticky ew
grid  .body.sj_label -row 2 -column 0 -sticky e
grid  .body.sj       -row 2 -column 1 -sticky ew
grid  .body.t .body.s  -row 3 -column 1 -sticky nsew
grid  columnconfigure  .body 0  -weight 1
grid  rowconfigure     .body 0  -weight 1


pack  .menubar .body -side top

frame   .end
button  .end.attach -text "Attach"
button  .end.cancel -text "Cancel"
button  .end.send -text "Send"

pack .end -fill x
pack .end.attach .end.cancel .end.send -side right -padx 2m -pady 1m -ipadx 2m -ipady 1m

Execute Tcl Online

tcl

puts "Hello World!" 

strings

tcl

#!/usr/bin/tclsh

set s1 "hello eximius world"
set s2 "1234 world is beautiful"
set s3 "world"
set s4 "Hello"
set s5 "world"
set s6 "e"
puts [string match $s3 $s5]

puts [string compare $s3 $s5]

puts [string first $s6 $s2]
puts [string toupper $s1]
puts [string tolower $s1 ]
puts [string last $s6 $s1]
puts [string length $s1 ]
puts [string trimleft $s1 $s2]
puts [string trimright $s1 $s2]
puts [string trim $s1 $s2]
puts [string match {is} $s2]

puts [string index $s1 10]
puts [wordend  $s1 10]
puts [wordstart $s2 5]
puts [wordend  $s2 7]
puts [wordstart $s1 6]

Execute Tcl Online

tcl

puts "Hello World!"
sets myname "hello world"
puts $myname

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.