Re: Having problem with SPLIT
- From: Bryan Oakley <oakley@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 30 Jun 2005 18:52:04 GMT
Earl Grieda wrote:
"Ralf Fassel" <ralfixx@xxxxxx> wrote in message news:yga1x6j99zj.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxx
* "Earl Grieda" <egriedaNOT@xxxxxxxxxxxxxxxxxxx> | if {$::DEBUG} {puts "FIRST0: $orgLine"}
Please show how 'orgLine' is set. Is it set orgLine "\tHeader with a tab"
orgline is set by reading a file (the email file). set orgLine [gets $inputFileID] and the line in the email file is \tHeader with a tab ;# \t is 2 chars
I then do set line [split [regsub -all { +} $orgLine " "]] to insure there is only one space between each word and make it a list so I can use list operations on it. The idea being that the first item in the list is a flag and, depending on the flag, some action is done with the rest of the line.
Ok, so you're reading a string and you're trying to treat it as a list of space-separated words. Only, it's not really a list of space separated words, it's really just a string with no guarantee of the format (other than the first "word" is really a flag).
That seems like a recipe for disaster.
Since you're only interested in the first word at this point, how about just pulling out the flag and leaving the rest of the data alone?
# put in whatever pattern fits your actual data
regexp {^([a-zA-Z0-9_]+)} $orgLine -- flagIs there a specific reason you're converting a string to a list, other than to make it easy to pick out the first word? It looks like the crux of your problem is that program A is changing the nature of the data before passing it to B. Thus, B gets a string representation of a list representation of the original string, which is not the same as the original string.
.
- Follow-Ups:
- Re: Having problem with SPLIT
- From: Earl Grieda
- Re: Having problem with SPLIT
- References:
- Having problem with SPLIT
- From: Earl Grieda
- Re: Having problem with SPLIT
- From: Bryan Oakley
- Re: Having problem with SPLIT
- From: Earl Grieda
- Re: Having problem with SPLIT
- From: Ralf Fassel
- Re: Having problem with SPLIT
- From: Earl Grieda
- Having problem with SPLIT
- Prev by Date: Re: TCL socket connection
- Next by Date: Re: Having problem with SPLIT
- Previous by thread: Re: Having problem with SPLIT
- Next by thread: Re: Having problem with SPLIT
- Index(es):