Clever find, yes, this way we can get rid of changing the closing tags
in global substitution such that one need only apply one global
substitution instead of two. Without the comment coloring of Eclipse
it does get confusing to read though. Concerning your //* method, I
would suggest to use something like //*! such that after replacing
this by /*! you can substitute backwards to //*! in order to re-
activate the code segments. with //* to /* alone there is no safe
return path. Basically here I just collapsed my earlier opening tag /
**/ // <xOpenIntents> into a shorter unique comment delimiter. So this
would give

   //*!
   int a = 1;
   int b = 1;
   /* */

where one can flip between //*! and /*! through global substitution.
Just as with #ifdef's, I'd rather keep the approach a little more
general such that I can selectively activate and deactivate code
sections in case I have more than just OpenIntents code to toggle on
and off. So I'd then opt for something more specific to OpenIntents
like

   //*<OpenIntents>
   int a = 1;
   int b = 1;
   /* */

and flip between //*<OpenIntents> and /*<OpenIntents>  through global
substitution. I guess all of this is considered heresy in some
circles. :-)

On Sep 10, 12:19 pm, Peli <[EMAIL PROTECTED]> wrote:
> Getting a little bit off-topic, but I was just wondering whether it is
> possible to select between two different code segments by replacing a
> single character only. I came up with the following solution:
>
> //*
> int a = 1;
> int b = 1;
> // */ int a = 2; /*
> // */ int b = 2; /*
> // */
> Log.d("test", "a = " + a + ", b = " + b);
>
> if I replace in the first line //* by /* (that is, take away the first
> dash "/"), then instead of a =1 and b=1 the lines a=2 and b=2 are
> executed.. :-)
> Or is there some easier way to accomplish this?
>
> Peli

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to