May 04, 2024, 12:27:05 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


IWSTRING, TSTRING and ITSTRING

Started by Andy, January 14, 2016, 05:33:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

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.
:) 
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Sorry Larry,

You've lost me on that one?

Andy.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

When I do that, the string just becomes "J" instead of "John Smith".


Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

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)
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

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.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

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?
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

January 14, 2016, 10:55:02 AM #8 Last Edit: January 14, 2016, 11:01:40 AM by andy1966
The j should be a capital J not j (lower case).

So it should print John Smith not john Smith.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

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.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

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.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

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"
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library