How to insert Chr(10)+Chr(34) into a line of text ?

Just starting out? Need help? Post your questions and find answers here.
vmars316
Enthusiast
Enthusiast
Posts: 474
Joined: Fri Jun 29, 2012 12:24 am
Contact:

How to insert Chr(10)+Chr(34) into a line of text ?

Post by vmars316 »

TIA ,
How to insert Chr(10)+Chr(34) into a line of text ?

Code: Select all

Procedure Break_BeforeBtn()
  Global BreakGadgetText$ , BreakGadgetText_2$ 
  BreakGadgetText$   =  GetGadgetText(Break_BeforeString) 
  BreakGadgetText_2$ = Chr(10)+Chr(34) + GetGadgetText(Break_BeforeString) 
  SetGadgetText(If_ThisInput_05 , BreakGadgetText$) 
  SetGadgetText(If_ThisInput_05_2 , BreakGadgetText_2$) 
  
  MessageRequester("Break BeforeBtn" , "BreakGadgetText$ = " + 
                                       BreakGadgetText$ + Chr(10)+Chr(34) +
                                       "BreakGadgetText_2$ = " + BreakGadgetText_2$)
;  
;  The result of MessageRequester shows: 
;       BreakGadgetText$ = 
;       "BreakGadgetText_2$ = 
;       "<
;  
  ReplaceStringButton() 
EndProcedure ; Break_BeforeBtn() 
The code in ReplaceStringButton() procedure works as expected
But it shows " as the first character in each new line .

Code: Select all

Procedure ReplaceStringButton()
Editor_Input_ItemsCount = CountGadgetItems(Editor_Input)
    MessageRequester("ReplaceStringButton" , 
                     If_ThisInput_05Text$ + Chr(10)+Chr(34) +
                      If_ThisInput_05_2Text$ )  ;  If_ThisInput_05
    
If Editor_Input_ItemsCount < 1 
    Goto Editor_Input_Missing
  EndIf

  ClearOutputFile()
  ThisInput_05Len = Len(GetGadgetText(If_ThisInput_05))  
  ThisInput_05_2Len = Len(GetGadgetText(If_ThisInput_05_2))
  If ThisInput_05Len  > 0    ;  And  ThisInput_05_2Len  > 0
    If_ThisInput_05Text$ = GetGadgetText(If_ThisInput_05)
    If_ThisInput_05_2Text$ = GetGadgetText(If_ThisInput_05_2)
    Editor_Input_ItemsCount = CountGadgetItems(Editor_Input)
    
    RepeatCount = 0
    Repeat 
      Editor_Input_ItemText$ = GetGadgetItemText(Editor_Input, RepeatCount) 
      
      Editor_Input_ItemText$ = ReplaceString(Editor_Input_ItemText$, If_ThisInput_05Text$, If_ThisInput_05_2Text$ )
      
      AddGadgetItem(Editor_Output , RepeatCount, Editor_Input_ItemText$ )
      
    RepeatCount = RepeatCount + 1
  Until RepeatCount = Editor_Input_ItemsCount 
    Else 
    MessageRequester("Procedure ReplaceStringButton()" , "Search Arg String Must contain a value , String Replacement Arg can be Empty .")
  EndIf ; Check if there are two Args
    
Editor_Input_Missing:
  If Editor_Input_ItemsCount < 1 
    MessageRequester("Editor_Input_Missing" , "Editor_Input_Missing , 'OPEN FILE'" +Chr(10)+Chr(34)+ 
    "Or Paste Text into 'INPUT Editor'" )
  EndIf
;debug "ReplaceStringButton() =  " + GetGadgetText(pathFile)

EndProcedure ; ReplaceStringButton() 
:
vmars.us Win11 x64 , Martin Guitar 000-16 (1995)
"All things in moderation , except for love and forgiveness."
User avatar
jacdelad
Addict
Addict
Posts: 2046
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: How to insert Chr(10)+Chr(34) into a line of text ?

Post by jacdelad »

I hope I understand your question: Chr(34) is the equivalent to ", so that's why there's a " at the start of every line. Do you maybe want to user Chr(13)+Chr(10) for the Windows linebreak? There are constants defined for that, namely #CRLF$, and #CR$ and #LF$ for the other style linebreaks.
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
infratec
Always Here
Always Here
Posts: 7706
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: How to insert Chr(10)+Chr(34) into a line of text ?

Post by infratec »

I'm to tired to make a working code out of your snippets.

So I can not help you.

Here is an example:

Code: Select all

MessageRequester("Info", "bla" + #LF$ + #DQUOTE$ + "bla")
vmars316
Enthusiast
Enthusiast
Posts: 474
Joined: Fri Jun 29, 2012 12:24 am
Contact:

Re: How to insert Chr(10)+Chr(34) into a line of text ?

Post by vmars316 »

Ah , perfect , Thank you very much !
vmars.us Win11 x64 , Martin Guitar 000-16 (1995)
"All things in moderation , except for love and forgiveness."
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: How to insert Chr(10)+Chr(34) into a line of text ?

Post by Psychophanta »

#LFCR$ is available too :wink:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
mk-soft
Always Here
Always Here
Posts: 6430
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: How to insert Chr(10)+Chr(34) into a line of text ?

Post by mk-soft »

#CRLF$ is valid order
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
Post Reply