Index: openacs-4/packages/acs-tcl/acs-tcl.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/acs-tcl.info,v diff -u -N -r1.95.2.16 -r1.95.2.17 --- openacs-4/packages/acs-tcl/acs-tcl.info 26 Sep 2020 11:40:52 -0000 1.95.2.16 +++ openacs-4/packages/acs-tcl/acs-tcl.info 8 Dec 2020 19:38:32 -0000 1.95.2.17 @@ -9,7 +9,7 @@ f t - + OpenACS The Kernel Tcl API library. 2017-08-06 @@ -18,7 +18,7 @@ GPL version 2 3 - + Index: openacs-4/packages/acs-tcl/tcl/00-icanuse-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/00-icanuse-procs.tcl,v diff -u -N -r1.1.2.17 -r1.1.2.18 --- openacs-4/packages/acs-tcl/tcl/00-icanuse-procs.tcl 7 Nov 2020 15:55:23 -0000 1.1.2.17 +++ openacs-4/packages/acs-tcl/tcl/00-icanuse-procs.tcl 8 Dec 2020 19:38:32 -0000 1.1.2.18 @@ -129,7 +129,8 @@ statements. Compatibility function for AOLserver or older versions of - NaviServer. Newer versions provide this command as builtin. + NaviServer. Newer versions of NaviServer provide this command + as builtin. } { set sql "" if { [llength $list] > 0 } { @@ -144,6 +145,34 @@ } } +if {[namespace which ::ns_trim] eq ""} { + + # ns_trim -- delimiter line trim command + # + # Strip from the begin of every line characters whitespace followed + # by the specified delimiter character. Example: + # + # puts [ns_trim -delimiter | { + # | Hello + # | World! + # }] + # + # This function could/should be coded in C for speed. + # + + ad_proc ns_trim {{-delimiter ""} text} { + if {$delimiter ne ""} { + set re "^\\s*\[$delimiter\](.*)$" + } else { + set re "^\\s*(\S*.*)$" + } + join [lmap line [split $text \n] { + regexp $re $line . line + set line + }] \n + } +} + # Local variables: # mode: tcl # tcl-indent-level: 4