How to get a doubleQuote into a string ?
How to get a doubleQuote into a string ?
Hello & Thanks ,
I know that the hex value is 22 ,
but I can't figure out how to get that into a string as a " .
Thanks...vm
I know that the hex value is 22 ,
but I can't figure out how to get that into a string as a " .
Thanks...vm
vmars.us Win11 x64 , Martin Guitar 000-16 (1995)
"All things in moderation , except for love and forgiveness."
"All things in moderation , except for love and forgiveness."
Re: How to get a doubleQuote into a string ?
Code: Select all
#DQ$ = Chr(34)
MyString$ = #DQ$ + "Hello" + #DQ$
debug MyString$
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: How to get a doubleQuote into a string ?
Hello vmars316. skywalk's right; although you could also use PureBasic's built-in constant, #DQUOTE$:

Code: Select all
MyString$ = #DQUOTE$ + "Hello" + #DQUOTE$
Debug MyString$Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel 
Re: How to get a doubleQuote into a string ?
Or even #DOUBLEQUOTE$ if you prefer ...
Code: Select all
MyString$ = #DOUBLEQUOTE$ + "Hello" + #DOUBLEQUOTE$
Debug MyString$
- StarBootics
- Addict

- Posts: 1006
- Joined: Sun Jul 07, 2013 11:35 am
- Location: Canada
Re: How to get a doubleQuote into a string ?
Another way around :
Code: Select all
MyString$ = Chr(34) + "Hello" + Chr(34)
Debug MyString$The Stone Age did not end due to a shortage of stones !
Re: How to get a doubleQuote into a string ?
Or, if you prefer to use the hexadecimal values:

Code: Select all
MyString$ = Chr(Val("$22")) + "Hello" + Chr(Val("$22"))
Debug MyString$Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel 
Re: How to get a doubleQuote into a string ?
Or, better yet, just straight hex without the Val() call (which is very slow, relatively speaking)TI-994A wrote:Or, if you prefer to use the hexadecimal values:Code: Select all
MyString$ = Chr(Val("$22")) + "Hello" + Chr(Val("$22")) Debug MyString$
Code: Select all
MyString$ = Chr($22) + "Hello" + Chr($22)
Debug MyString$-
Little John
- Addict

- Posts: 4805
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: How to get a doubleQuote into a string ?
It was meant as a caricature to the preceding two posts.Tenaja wrote:Or, better yet, just straight hex without the Val() call (which is very slow, relatively speaking)TI-994A wrote:Or, if you prefer to use the hexadecimal values:Code: Select all
MyString$ = Chr(Val("$22")) + "Hello" + Chr(Val("$22")) Debug MyString$Code: Select all
MyString$ = Chr($22) + "Hello" + Chr($22) Debug MyString$
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel 
Re: How to get a doubleQuote into a string ?
Wait until Wilbert reads this thread.
Then you'll get the fastest possible way in assembler.

Then you'll get the fastest possible way in assembler.
Re: How to get a doubleQuote into a string ?
Sorry to disappoint you, no assembler this timeinfratec wrote:Wait until Wilbert reads this thread.
Then you'll get the fastest possible way in assembler.
![]()
![]()
I liked the solution Little John gave with
Code: Select all
Chr('"')Code: Select all
DataSection
MyString:
!db 'This is a test "string".', 0
EndDataSection
S.s = PeekS(?MyString, -1, #PB_Ascii)
Debug SWindows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: How to get a doubleQuote into a string ?
@wilbert
very nice
very nice
Code: Select all
t.s = "'Hallo World'"
ReplaceString(t, "'", #DQUOTE$, #PB_String_InPlace)
Debug t
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: How to get a doubleQuote into a string ?
wrapping it in a macro is perhaps more convenient
Code: Select all
Macro DQ(text)
#DQUOTE$ + text + #DQUOTE$
EndMacro
mystring.s = DQ("foo") + "," + DQ("bar")
Debug mystring
Windows 11, Manjaro, Raspberry Pi OS


Re: How to get a doubleQuote into a string ?
Ah, great help! Thanks..vmskywalk wrote:Code: Select all
#DQ$ = Chr(34) MyString$ = #DQ$ + "Hello" + #DQ$ debug MyString$
vmars.us Win11 x64 , Martin Guitar 000-16 (1995)
"All things in moderation , except for love and forgiveness."
"All things in moderation , except for love and forgiveness."
Re: How to get a doubleQuote into a string ?
Ah, good to know! Thanks..TI-994A wrote:Hello vmars316. skywalk's right; although you could also use PureBasic's built-in constant, #DQUOTE$:Code: Select all
MyString$ = #DQUOTE$ + "Hello" + #DQUOTE$ Debug MyString$
vmars.us Win11 x64 , Martin Guitar 000-16 (1995)
"All things in moderation , except for love and forgiveness."
"All things in moderation , except for love and forgiveness."



