Re: How to treat puts <value> as pure text - not a command



Hi,

is this the error you get:

#############################
missing close-brace
while executing
"while { [gets $infile in_line] >=0 } {
set open_comment [lsearch -exact $in_line "/*"]
set close_comment [lsearch -exact $in_line "*/"]

if {$op..."
(file "bracing.tcl" line 2)

#################################################

as input tested the next 3 lines:
ljslfs {
{
}


now: $in_line is a string and _not_ a proper list

the way to find your comments would be better served by

string first $in_line "/*"

which would return the index of the first found incidence, or -1 ...



<man n string>
string first string1 string2 ?startIndex?
Search string2 for a sequence of characters that exactly match
the characters in string1. If found, return the index of the
first character in the first such match within string2. If not
found, return -1. If startIndex is specified (in any of the
forms accepted by the index method), then the search is con-
strained to start with the character in string2 specified by the
index. For example,
string first a 0a23456789abcdef 5
will return 10, but
string first a 0123456789abcdef 11
will return -1.


uwe
.



Relevant Pages

  • Re: StringBuilder.Append() pequliarities
    ... you have to pad the string first: ... 16 characters and will have to reallocate memory right off to take a string ... capacity for each reallocation, so the above code would expand the capacity ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Parsing JSON (#155)
    ... and safest to read the entire file/stream into a String first. ... complained about the inflexibility of regex. ... This works on arbitrary characters and arbitrary iterators (into ...
    (comp.lang.ruby)
  • Re: Inheritance
    ... protected string m_First; ... public void Write(int ID, string First, string Last) ... protected int m_Graduation; ...
    (microsoft.public.dotnet.general)
  • Re: Grabbing elements from a string
    ... > I need some pointers on how to efficiently and effectively extract ... I have a string read in from a file ...
    (comp.lang.tcl)
  • Re: "ref object a" <> "ByRef a As Object" ???
    ... public void SplitName (string wholeName, out string firstName, ... do they're just as likely to be reference types as value types. ...
    (microsoft.public.dotnet.general)