12.12.2012 Views

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

More on Projects<br />

menu or press Ctrl+F. To <strong>in</strong>voke the Replace dialog box, choose Search | Replace from the<br />

menu or press Ctrl+R. Figure 10.12 shows the <strong>C++</strong>Builder Replace dialog box. With a couple<br />

of obvious exceptions, the F<strong>in</strong>d dialog box conta<strong>in</strong>s the same options.<br />

Figure 10.12.<br />

The Replace Text<br />

dialog box.<br />

For the most part, the options on the F<strong>in</strong>d and Replace dialog boxes do exactly what they<br />

<strong>in</strong>dicate. If you choose the Case sensitive option, you need to type <strong>in</strong> the search text exactly<br />

as it appears <strong>in</strong> the source file.<br />

The Whole words only option requires a word of explanation. <strong>C++</strong> code is, obviously, not<br />

pla<strong>in</strong> text. Take the follow<strong>in</strong>g l<strong>in</strong>e, for <strong>in</strong>stance:<br />

Memo->Caption = GetCaption();<br />

In this case neither Memo, Caption, nor GetCaption could be considered a whole word because<br />

they are surrounded by special <strong>C++</strong> syntax characters. If you search for the word Memo and have<br />

the Whole words only option on, the F<strong>in</strong>d operation will ignore syntax characters and will<br />

still f<strong>in</strong>d Memo <strong>in</strong> this l<strong>in</strong>e.<br />

The Regular expressions option requires explanation as well. When this option is on, you can<br />

use special wildcard characters when do<strong>in</strong>g searches. For a complete description of the<br />

wildcard characters, see the <strong>C++</strong>Builder onl<strong>in</strong>e help under the topic Regular Expressions.<br />

When replac<strong>in</strong>g text, it is safest to leave on the Prompt on replace option. When you do a<br />

Replace All operation with this option on, the editor highlights each found word and prompts<br />

you whether to replace it. It is easy to miscalculate the results of a Replace All operation, so<br />

always use Replace with care. Even then, it still pays to remember that maxim: “Undo is your<br />

friend.”<br />

The rest of the F<strong>in</strong>d and Replace options are self-explanatory and therefore don’t need<br />

additional mention.<br />

379<br />

10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!