Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 2 Jahren, 4 Monaten
Letzter Beitrag:
vor 2 Jahren, 4 Monaten
Beteiligte Autoren:
Yogi Yang, DarrenF, Ola, Mike H, Paulo Oliveira, Piet van Zanten

How to build such complex strings with double quotes easily?

Startbeitrag von Yogi Yang am 02.02.2016 10:44


I am trying to build a string which is getting a bit too long as it contains double quotes.

Here is the code:

bufRetValueBuffer = Charact(34) + "ok" + Charact(34) + "," + Charact(34) + Charact(34) + "," + Charact(34) + Charact(34) + "," + Charact(34) + Charact(34) + "," + Charact(34) + Charact(34)

I should the string like this:


Is there any easier way to build strings with quotes (single as well as double)?


Yogi Yang


Just doudle them or use the sintax:

my_string is string=[
aaa "bb" ccc


von Paulo Oliveira - am 02.02.2016 12:46
Hi, Yogi.
Two suggestions:
1. The quick and dirty way is to define a 1-character string for double quotes
DQ is string=Charact(34)

Your command would look like

2. A fancier way would be to define a procedure (local or global)
RESULT Charact(34)+x+Charact(34)

Your command would look like

von Mike H - am 02.02.2016 12:48
Hi Yogi,

I think you can use triple quotes.
For better readability you could also use:
bufRetValueBuffer = Replace("-ok-,--,--,--","-",Charact(34))
bufRetValueBuffer = StringBuild("%1ok%1,%1%1,%1%1,%1%1",Charact(34))


von Piet van Zanten - am 02.02.2016 12:50
Hi Yogi

In addition to the other suggestions:
If the length of the line is a problem, as you said, you can cut it into two or more lines with ... (three periods). Like:

DQ is string=Charact(34)


best regards

von Ola - am 02.02.2016 12:55
You could also try building a string that contains "%1","%2","%3",... as many as you need.

Then StringBuild(YourString,Forename,Surname,Address1...)

Then you would see something like "Fred","Bloggs","1 High Street",...

Don't forget, you can also use arrays to build the content :spos:


von DarrenF - am 02.02.2016 13:40
Paulo Oliveira
Just doudle them or use the sintax:
my_string is string=[
aaa "bb" ccc


Thanks for the hint. It works perfectly and as I need it. Instead of adopting suggestions by others I prefer to go with your suggestion. It is easier and cleaner.

Thank you,

Yogi Yang

von Yogi Yang - am 02.02.2016 13:54
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.