lreplace command inconsistent behaviour
From: Ramsunder (wfrg1225_at_motorola.com)
Date: 02/16/04
- Next message: Jeff Hobbs: "Re: http::geturl in starkit/starpack"
- Previous message: Jos Decoster: "http::geturl in starkit/starpack"
- Next in thread: Benjamin Riefenstahl: "Re: lreplace command inconsistent behaviour"
- Reply: Benjamin Riefenstahl: "Re: lreplace command inconsistent behaviour"
- Reply: Bryan Oakley: "Re: lreplace command inconsistent behaviour"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 16 Feb 2004 07:49:13 -0800
following lines are in a file names lreplace.test
set line {'Bauelemente-Name ' ' GF' PIP BpEb SG [Abmasse
[Abholposition [B
estueckposition [Abholort [Zeiten ]
'Position'}
puts "line: $line"
while { 1 } {
set index [ lsearch -glob $line {\[*} ]
if ![ string compare $index -1 ] then {
break
}
set line [ lreplace $line $index $index DUMMY ]
puts "line in while: $line"
}
puts "line after regsub: $line"
running it on TCL shell, one will get the following result
line: 'Bauelemente-Name ' ' GF' PIP BpEb SG [Abmasse
[Abholposition [Bestueckposition [Abholort [Zeiten
] 'Position'
line in while: 'Bauelemente-Name ' ' GF' PIP BpEb SG DUMMY
{[Abholposition} {[Bestueckposition} {[Abholort} {[Zeiten} \]
'Position'
line in while: 'Bauelemente-Name ' ' GF' PIP BpEb SG DUMMY DUMMY
{[Bestueckposition} {[Abholort} {[Zeiten} \] 'Position'
line in while: 'Bauelemente-Name ' ' GF' PIP BpEb SG DUMMY DUMMY DUMMY
{[Abholort} {[Zeiten} \] 'Position'
line in while: 'Bauelemente-Name ' ' GF' PIP BpEb SG DUMMY DUMMY DUMMY
DUMMY {[Zeiten} \] 'Position'
line in while: 'Bauelemente-Name ' ' GF' PIP BpEb SG DUMMY DUMMY DUMMY
DUMMY DUMMY \] 'Position'
Just check in output line 2(line in while), second last element, it
get appended by "\" while in older version of TCL, say 7.3(since I
have that)
This is not he behaviour and it is working fine., output of lreplace
command just shows me ] as second last element of resultant list.
- Next message: Jeff Hobbs: "Re: http::geturl in starkit/starpack"
- Previous message: Jos Decoster: "http::geturl in starkit/starpack"
- Next in thread: Benjamin Riefenstahl: "Re: lreplace command inconsistent behaviour"
- Reply: Benjamin Riefenstahl: "Re: lreplace command inconsistent behaviour"
- Reply: Bryan Oakley: "Re: lreplace command inconsistent behaviour"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]