Page 1 of 1

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

Posted: Fri Nov 24, 2023 9:34 pm
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() 
:

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

Posted: Fri Nov 24, 2023 9:48 pm
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.

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

Posted: Fri Nov 24, 2023 10:16 pm
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")

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

Posted: Sat Nov 25, 2023 7:27 pm
by vmars316
Ah , perfect , Thank you very much !

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

Posted: Sun Nov 26, 2023 11:03 am
by Psychophanta
#LFCR$ is available too :wink:

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

Posted: Sun Nov 26, 2023 12:19 pm
by mk-soft
#CRLF$ is valid order