Hi,
After posting my latest update to my "String Theory" offering,
http://www.ionicwind.com/forums/index.php?topic=5802.0 (you can download the latest version - at the end of the post).
Larry did mention about Wstrings and Tstrings which I was debating about to myself, so I thought I would look a little closer.
I have compiled the examples for IWSTRING and ITSTRING and they don't compile.
OPENCONSOLE
'Define a string of exactly 30 characters
DEF name[30]:IWSTRING
name = L"john Smith"
name[0] = L"J"
PRINT W2S(name)
PRINT "Press any key to close"
DO:UNTIL INKEY$ <> ""
CLOSECONSOLE
END
Gives an "cannont assign wstring to word" error for the line - name[0] = L"J"
and It's the same for the Tstring example.
So, It's probably me, or am I missing something here...
It would be interesting to look at adding unicode characters to the string program, it depends for me on how much work would be involved, and how many people would think it useful.
Thanks,
Andy.
:)
Sorry Larry,
You've lost me on that one?
Andy.
get rid of the '[0]'
When I do that, the string just becomes "J" instead of "John Smith".
Quote from: andy1966 on January 14, 2016, 06:16:21 AM
When I do that, the string just becomes "J" instead of "John Smith".
duh
That's what the program you posted told it to do
DEF name[30]:IWSTRING
name = L"john Smith"
name = L"J"
PRINT W2S(name)
No Larry,
That's what you said I needed to change.
And we are only amending the examle program, not mine!
It doesn't work as stated.
Now I'm confused.
I this thread you posted this code
OPENCONSOLE
'Define a string of exactly 30 characters
DEF name[30]:IWSTRING
name = L"john Smith"
name[0] = L"J"
PRINT W2S(name)
PRINT "Press any key to close"
DO:UNTIL INKEY$ <> ""which you said wouldn't compile because it gave you an error on line 10
which is this line
name[0] = L"J"I tried to compiled the program and duplicated your result.
I changed line 10 to read
name = L"J"It compiled fine and printed
QuoteJ
as you would expect from the code
I commented out line 10 and recompiled/ran.
The output was
Quotejohn Smith
as expected from the posted code.
So what are you saying is wrong?
The j should be a capital J not j (lower case).
So it should print John Smith not john Smith.
It finally dawned on me that in line 10 you were trying to substitute the 1st character in the string to replace the small j with a caps J. That's a super sized DUH on me. Mark it down to a senior moment. ::) ::)
Looks to me like you have found a bug in the compiler; thats the only way I can explain it.
We'll have to put it down for LarryS.
Looks like It's a bug Larry,
Don't mean to find these things, and I really hate being a pain in the you know what! that's not why I ask questions.
Andy.
:)
It's not being a pain when you find a bug; generally speaking, when you identify and document a bug, you are saving other people a lot of pain because they don't have to go through the same discovery process you did.
So I say "thank you"