Subject: | Re: backslash in dynarray
| Date: | 15 Mar 2023 01:08:56 -0400
| From: | "Kevin Zawicki" <numberjack@wi.rr.com>
| Newsgroups: | pnews.paradox-programming
|
Interesting...
Comment out all but
dynName["_\T`3e"] = 11
Add at end of code:
dynName.view()
foreach s in dynName
s.view()
endforeach
s.view() shows _`3e value 11
The T is gone, and now a (invisible) TAB is between underscore and `
\T is a tab, so you created a dynarray element with a TAB in middle.
It does work.
If you want
_\T`3e
You have to escape it with a \
_\\T`3e
Try
dynName["_\R`3e"] = 11
then
dynName["_\\R`3e"] = 11
R is similar to T, BUT
Cannot see it as easily
When viewing s set to _\R`3e
copy the viewing of _\R`3e which looks like _\`3e to clipboard and
paste into notepad
you will see
_
`3e
A line break after the underscore. The string is two lines.
The control character is viewable in a string, but TAB can actually be scene,
line break, etc cannot.
a,b,f,n,r,t,v
\a = Alert (bell)
\b = backspace?
\f = form feed ?
\n = newline or line feed
\r = carriage return
\t = tab
\v = vertical tab?
You would have to parse and add two backslashes for these letters, I think.
Best practice is to not use them in dynarray elements, even though they can
work because any string can work.
I avoid backslashes altogether in such things. It creates headaches when
reading / translating.
Curious, why the need for backslashes here?
Peter <peterspammenot@whiteknight.email> wrote:
>
>Ran into a a problem with a backslash in a dynarray element. Sometimes I
>get a "Error: identifier expected" and other instances it does work
>dynName dynarray[]smallint
>
>These examples work
>dynName["_\T`3e"] = 20
>dynName["T_i\a"] = 10
>
>These do not work
>dynName["c[\_"] = 5
>dynName["WTi\W3Z"] = 21
>
>I did more testing and found the only letters that will work after a
>backslash are: a,b,f,n,r,t,v. Case insensitive.
>
>All numers work and single quote (")
>
>Does anyone know the reason for the ones that fail? Thanks.
>
>I have attached a form that contains a dynarray defined in the form:open
>event. It shows what I am talking aboout
>
>ps
>I know for the ones that fail, it can be solved by using a double
>backslash but that causes other problems.
>
>
|