
Double-quotes in strings
Re: Double-quotes in strings
@Thade +1


Re: Double-quotes in strings
Ha, not stupid, just overworked.Danilo wrote:I added this constants to PB, round about 9 or 10 years ago. It is my fault I didn't add the short #DQ$ too. Sorry skywalk for being so stupid!IdeasVacuum wrote:I didn't know that!We all know we can use DQUOTE$

Really should add #DQ$ now.
Wow, did I hate """'&'""" in VB6...Talk about eye strain

The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: Double-quotes in strings
Code: Select all
myString.s = "He said ''hello'' to her"
Debug ReplaceString(myString, "''", Chr(34)) ; Outputs -> He said "hello" to her

Greetings ... Kiffi
Hygge
Re: Double-quotes in strings
It all depends if you want to cater to "database programs" or "everything except database programs."MachineCode wrote:I didn't realise it would ruin database queries, so I guess it's not such a good idea after all.....
Personally, I'd much rather have the new feature, and I can always use the #SingleQuote$ for the db queries.
-
- Addict
- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Re: Double-quotes in strings
Yes, Kiffi, but it adds overhead and time (no matter how small). A compiler replacement would treat it like a constant, with zero overhead. But as pointed out, I didn't realise it would affect database strings, so I'm happy to drop the suggestion. I don't use databases so they never occurred to me.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!
Re: Double-quotes in strings
Again, the general idea is good. That's why we discuss it here. It is just not as easy to pick some random characters you like ('' or $$ or %%)
and use this now as auto replacement for double quotes. As we have seen here, it breaks other things.
You think it looks ugly, but technically the VB way is the best. You can't use " within strings now, as it ends the string. You can
use all other printable characters within strings, but not ". So adding VB-like support is the shortest solution to write, and also very easy to implement.
" starts a string. Now scan for next occurrence of ". If next character is again ", replace both with chr(34) and continue scanning for next ",
otherwise it was the string end. Easy to add to parser/compiler and to IDE for syntax highlighting. And common to guys coming from other BASIC languages.
Additionally add #DQ$ to residents, so traditional #DOUBLEQUOTE$, #DQUOTE$ and Chr(34) can be written even shorter.
It is also 100% backward compatible.
and use this now as auto replacement for double quotes. As we have seen here, it breaks other things.
You think it looks ugly, but technically the VB way is the best. You can't use " within strings now, as it ends the string. You can
use all other printable characters within strings, but not ". So adding VB-like support is the shortest solution to write, and also very easy to implement.
" starts a string. Now scan for next occurrence of ". If next character is again ", replace both with chr(34) and continue scanning for next ",
otherwise it was the string end. Easy to add to parser/compiler and to IDE for syntax highlighting. And common to guys coming from other BASIC languages.
Additionally add #DQ$ to residents, so traditional #DOUBLEQUOTE$, #DQUOTE$ and Chr(34) can be written even shorter.
It is also 100% backward compatible.
Re: Double-quotes in strings
Not too mention that this would have the possibility to wreak havoc with encrypted data embedded into codeDanilo wrote:In my opinion PB should not replace anything within my strings automatically. So using the double quote character itself (like VB) would be the only valid option, because it is the only printable character that can't be used in strings directly.

HP Z800 Workstation
CPU : Dual Xeon 5690 3.46GHz
RAM : 96GB RAM ( 8GB x 12 )
PSU : 1100W
GPU : NVIDIA RTX 3050 8GB
STORAGE : 9TB
(4) 2TB Seagate IronWolf Pro HDD
(1) 1TB Samsung 870 EVO SSD
CPU : Dual Xeon 5690 3.46GHz
RAM : 96GB RAM ( 8GB x 12 )
PSU : 1100W
GPU : NVIDIA RTX 3050 8GB
STORAGE : 9TB
(4) 2TB Seagate IronWolf Pro HDD
(1) 1TB Samsung 870 EVO SSD
Re: Double-quotes in strings
sure?Danilo wrote:It is also 100% backward compatible.
Code: Select all
text.s = "I'm a " + string + ", but a variable or a constant?"
Code: Select all
text.s = "I'm a ""string"" and just constant!"
text.s = "I'm a " + string + " and a variable!"
Code: Select all
text.s = "I'm a string" + ' created with "single" and "double" quotes.'
Re: Double-quotes in strings
Yes, absolutely.PMV wrote:sure?Danilo wrote:It is also 100% backward compatible.
Not possible. It's just a mess of characters. For example, ' is used for character constants already, like 'a' in a Case switch.PMV wrote:As i see the example VB expects double double quotes.It seems handy, but i would like to have the possibility to interchange it with single quotes.Code: Select all
text.s = "I'm a ""string"" and just constant!" text.s = "I'm a " + string + " and a variable!"
Code: Select all
text.s = "I'm a string" + ' created with "single" and "double" quotes.'
It is one of the problems in this forum: Ordinary People without any qualification and without deeper thinking
make suggestions and think they are right, where they don't know anything about the specific topic.
To make suggestions to the internals of a compiler, you should have studied compiler and programming languages design,
and at least have written one or two compilers. Problem here is, everybody who knows nothing and everybody who has
not a deeper understanding of a specific topic, can make suggestions that make no sense.
I don't know yet how we can handle this problem. It is meeting absolute beginners with experts that studied a topic for years.
Beginners make non-sense requests all the time, and experts in the field give answers. Beginners don't believe what the experts say.
It can be very annoying from time to time, and experts usually don't want to spend their time answering beginner's questions
and explain everything, as they have other things to do.
Maybe any suggestions to THAT problem?
Re: Double-quotes in strings
Was that really necessary, please think twice before posting after
your bier! Are you really drunk at this time? Or just mad of some
one in reallife? I don't know why, but please ... it is a discussion ...
it is not more stupid then every other post here, including yours.
Especially, why do have customers have to study a specific
topic before they are allowed to make wishes that someone else
needs to handle? lol! No one would be allowed to make wishes
anywhere.
And even so i have forgotten about the character-use, it is still
not unpossible and up to fred who makes the final decision.
We just discuss it in public.
MFG PMV
your bier! Are you really drunk at this time? Or just mad of some
one in reallife? I don't know why, but please ... it is a discussion ...
it is not more stupid then every other post here, including yours.
Especially, why do have customers have to study a specific
topic before they are allowed to make wishes that someone else
needs to handle? lol! No one would be allowed to make wishes
anywhere.
And even so i have forgotten about the character-use, it is still
not unpossible and up to fred who makes the final decision.

We just discuss it in public.
MFG PMV
Re: Double-quotes in strings
Actually I thought it was a good explanation of why we don't get feedback to all the feature requests.
Finally, someone telling it like it is.
Finally, someone telling it like it is.

-
- Addict
- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Re: Double-quotes in strings
+1Danilo wrote:" starts a string. Now scan for next occurrence of ". If next character is again ", replace both with chr(34) and continue scanning for next ",
otherwise it was the string end. Easy to add to parser/compiler and to IDE for syntax highlighting. And common to guys coming from other BASIC languages.

Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!
Re: Double-quotes in strings
Yes, it is absolutely necessary to discuss this topic. It is a real world situation here.PMV wrote:Was that really necessary, please think twice before posting
Experts meeting beginners, and beginners don't believe what experts in a field say.
Experts justify everything, they explain what is better and why it is better. Beginners
just wish things, without a deeper understanding. You understand Darwin's evolution theory,
but you never ever read Darwin's books? It is the same for compiler stuff. Did you read
80 books about compiler design? No? You can still make any request, but some things
just can't work as you dreamed it! For some advanced things you just need a deeper understanding
of that specific topic. You don't have a clue of politics, but you always know what is
the right thing to do in politics. It is one problem of our time, that everybody thinks
he knows everything! In this case, I really recommend reading Darwin, where he compares
man with other animals. It is at least a start for deeper understanding.
BTW, Darwin's books are available for free on Kindle (for Kindle, PC, Mac, ...)

Re: Double-quotes in strings
I'm not part of the problem. I always think of "do i haveDanilo wrote:Yes, it is absolutely necessary to discuss this topic. It is a real world situation here.PMV wrote:Was that really necessary, please think twice before posting
Experts meeting beginners, and beginners don't believe what experts in a field say.
Experts justify everything, they explain what is better and why it is better. Beginners
just wish things, without a deeper understanding. You understand Darwin's evolution theory,
but you never ever read Darwin's books? It is the same for compiler stuff. Did you read
80 books about compiler design? No? You can still make any request, but some things
just can't work as you dreamed it! For some advanced things you just need a deeper understanding
of that specific topic. You don't have a clue of politics, but you always know what is
the right thing to do in politics. It is one problem of our time, that everybody thinks
he knows everything! In this case, I really recommend reading Darwin, where he compares
man with other animals. It is at least a start for deeper understanding.
BTW, Darwin's books are available for free on Kindle.
undstand it right?" ... but i'm a human. Believe it or not,
you too. You make mistakes as i did. If you would be that
good, you have seen on your own, that i have just miss read
your post. As you can see, i have written the same thing after
saying, "are you sure?" by writing "VB wants double double qoutes".
Do you have to study communication now?

Re: Double-quotes in strings
People who expect other people to read their mind, should probably not be posting at all.PMV wrote: If you would be that
good, you have seen on your own, that i have just miss read
your post.
