Re: dealing with special characters



Hello Stuart,

If you have complicated strings in your source code and you do not
need any substitutions you may but the data into curly braces:
set MESS {15C3A33C 186005017"B1B@
\y@]@@]G@]M@]R@]V@]W@]Y@]]@]]@]e@]k@]s@]}@^F@^R@^X@^^@^k@^s@_B@_L@_U@__@_g@_q@_}@_?
@`F@`G@`J@`Q@`Q@`X@``@`k@`t@aA@aM@aW@ae@am@a~@bD@bO@bT@bY@bb@bc@b]@b
\@bc@bo@b{@cF@cU@c\@cb@cl@cv@]R@^s@`]@b^@Lr:BATTLOAD 0 13.42 36+0NN170W}

In contrast, if you use "" as string embracing characters, you may use
special characters like \ (escape), $ (variable substitution) or []
(command execution). One helpful escape for ugly strings is \u00xx
where xx is the hex code of the character.

On 8 Jul., 03:45, Stuart <bigdak...@xxxxxxx> wrote:
set MESS "15C3A33C 186005017\"B1B@
\y@]@@]G@]M@]R@]V@]W@]Y@]]@]]@]e@]k@]s@]}@^F@^R@^X@^^@^k@^s@_B@_L@_U@__@_g@_q@_}@_?
@`F@`G@`J@`Q@`Q@`X@``@`k@`t@aA@aM@aW@ae@am@a~@bD@bO@bT@bY@bb@bc@b]@b
\@bc@bo@b{@cF@cU@c\@cb@cl@cv@]R@^s@`]@b^@Lr:BATTLOAD 0 13.42  36+0NN
170W"
set MESS [lrange $MESS 1 end]
puts "MESS $MESS"

I suppose you want to return character 1 to the end. This might be
acheved using the string range command:
set MESS [string range $MESS 1 end]

Hope this helps,
Harald
.



Relevant Pages

  • Re: dealing with special characters
    ... set MESS ... never use list commands on strings unless you know for a fact the string is a well formed list. ... If you treat lists as lists and strings as strings, it should never be a problem in practice. ...
    (comp.lang.tcl)
  • dealing with special characters
    ... I have an ugly string to parse ... set MESS ... Whats the best way to handle strings of this nature, ...
    (comp.lang.tcl)
  • Re: basics
    ... > int main ... // Why mess around with the file when you can just mess with the string? ... // char & get ...
    (alt.comp.lang.learn.c-cpp)
  • Re: dealing with special characters
    ... The absolute first thing to do is to recognize the difference between a ... list and an arbitrary string. ... set MESS ...
    (comp.lang.tcl)
  • Re: Duplicates in excel that arent 100% DUPLICATES ...
    ... want the name of the street because the end of the string varies (i.e. ... Mid works the same as left put extracts the middle of a string. ... Westbourne" from "111 Westbourne Terr. ... sort through the mess. ...
    (microsoft.public.excel.misc)