PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WD18] Still going wrong [search & replace]
[WD18] Still going wrong [search & replace]
Débuté par Ola, 22 avr. 2014 11:04 - 3 réponses
Posté le 22 avril 2014 - 11:04
Hi All

I am totally flabbergasted to find out that, in WD18, I cannot find (and replace), verbatim, a string containing or enclosed in quotation marks (inch marks).
Like:
I want to find "A sentence" and replace it with a string variable sSentence.
I only find (and can replace) the contents inside the quotation marks, but not the quotation marks.

What's the trick? Am I missing something, or is this really impossible?
I already tried double quotation marks in the searchable string...

I think I did have this problem in WD16...

best regards
Ola
Posté le 22 avril 2014 - 11:22
Hello Ola

It is more difficult than it was but the secret is to highlight the text you want to find, including the quote marks then press Ctrl F to send the highlighted text to the search window.

The search option will wrap the highlighted text inside a double set of quotes giving you three sets of double quote marks before and after your text so your phrase will end up as """A sentence""" in the search box.

It will then find and replace correctly but I still don't trust it with the replace because I had some bad experiences when I first started using V18, so whenever quotes are involved in a search, I do the replace by hand.

Regards
Al
Posté le 22 avril 2014 - 11:23
Hi Ola, as you know, the Charact(34) is a special thing because it is used to describe a string of characters as well. Most programming languages - W-Language as well - are using double quotes in this case.

MyString = "MyName" => will contain the string MyName only - the quotes will disappear.
MyString = ""MyName"" => will truly contain the quote characters at the start and at the end of "MyName".

Sometimes one can circumvent this need by using Charact(34) instead of the quote character. In principle it is the same as a quote but you can see clearer ...

MyString = Charact(34)+"MyName"+Charact(34) will contain true "MyName"
Posté le 22 avril 2014 - 11:52
Thank you guys!

@Al,
you're a regular nail hitter! It works the way you described. Highlighting + Control-F moves the selection with the double quotes added (except sometimes -- but then adding the extra quotes manually worked). Also replacing worked automatically and correctly.

@Guenter,
as I already mentioned in my question, double quotes do not work. Triple quotes work.
I didn't try "Charact(34)" as quotes are easier and faster to enter.

best regards
Ola