Subject | quoting scripts and code - retaining format |
---|---|
Author | csswa |
Post date | 2002-04-27T11:00:27Z |
Here's a suggestion for anyone who wants to avoid having Yahoo Groups
gobble up the leading space on quoted source code.
Dump your code into a text editor capable of search-replace. Search
and replace the space character with character code 0183 (hold alt,
enter 0183 on numkeypad, release). Select all and dump back into
your email/webmail message. If someone wants to copy and run your
posted code, they select all, copy to their text editor, do a reverse
search-replace to the aforementioned, and voila, all
spacing/formatting is back the way the author intended. For example:
Here's formatted code I know Yahoo is going to left-align.
ADD CONSTRAINT SAMP_FLUID_AGE_UOM_FK_VALID
CHECK
(
EXISTS
(
SELECT 1
FROM T_CODESET
WHERE (CODE_SET = 'AUOM')
AND (CODE_CODE = NEW.SAMP_FLUID_AGE_UOM_FK)
)
),
Now here's the same code with formatting protection:
···ADD·CONSTRAINT·SAMP_FLUID_AGE_UOM_FK_VALID
······CHECK
·········(
·········EXISTS
············(
············SELECT·1
············FROM·T_CODESET
············WHERE·(CODE_SET·=·'AUOM')
············AND·(CODE_CODE·=·NEW.SAMP_FLUID_AGE_UOM_FK)
············)
·········),
I'm rather pendantic about my formatting, as you can see, so it might
just be me who'll be using this technique. :-)
Regards,
Andrew Ferguson
gobble up the leading space on quoted source code.
Dump your code into a text editor capable of search-replace. Search
and replace the space character with character code 0183 (hold alt,
enter 0183 on numkeypad, release). Select all and dump back into
your email/webmail message. If someone wants to copy and run your
posted code, they select all, copy to their text editor, do a reverse
search-replace to the aforementioned, and voila, all
spacing/formatting is back the way the author intended. For example:
Here's formatted code I know Yahoo is going to left-align.
ADD CONSTRAINT SAMP_FLUID_AGE_UOM_FK_VALID
CHECK
(
EXISTS
(
SELECT 1
FROM T_CODESET
WHERE (CODE_SET = 'AUOM')
AND (CODE_CODE = NEW.SAMP_FLUID_AGE_UOM_FK)
)
),
Now here's the same code with formatting protection:
···ADD·CONSTRAINT·SAMP_FLUID_AGE_UOM_FK_VALID
······CHECK
·········(
·········EXISTS
············(
············SELECT·1
············FROM·T_CODESET
············WHERE·(CODE_SET·=·'AUOM')
············AND·(CODE_CODE·=·NEW.SAMP_FLUID_AGE_UOM_FK)
············)
·········),
I'm rather pendantic about my formatting, as you can see, so it might
just be me who'll be using this technique. :-)
Regards,
Andrew Ferguson