Skip to content

Commit 6c488dd

Browse files
authored
Add Capitalize in Tcl (#5044)
1 parent 45ce5c1 commit 6c488dd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

archive/t/tcl/capitalize.tcl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
proc usage {} {
2+
puts stderr {Usage: please provide a string}
3+
exit 1
4+
}
5+
6+
if {$argc < 1} { usage }
7+
8+
set buf [string trim [lindex $argv 0]]
9+
if {$buf eq ""} { usage }
10+
11+
set first [string toupper [string index $buf 0]]
12+
set rest [string range $buf 1 end]
13+
puts "${first}${rest}"

0 commit comments

Comments
 (0)