Skip to content

Commit 7655f2a

Browse files
authored
Add Remove All Whitespace in Tcl (#5077)
1 parent ff95149 commit 7655f2a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package require Tcl 8.6
2+
3+
proc usage {} {
4+
puts stderr {Usage: please provide a string}
5+
exit 1
6+
}
7+
8+
proc removeWhitespace {str} {
9+
regsub -all {\s} $str {} result
10+
return $result
11+
}
12+
13+
if {$argc != 1} { usage }
14+
set input [lindex $argv 0]
15+
if {$input eq ""} { usage }
16+
17+
puts [removeWhitespace $input]

0 commit comments

Comments
 (0)