Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/prog/ challenge: ``proper quotes''

Name: Anonymous 2008-08-12 20:08

Write a program that takes a text file and converts adirectional quotes into `` and '', i.e.

INPUT:
I turned my head around, with that casual smile all over my face.
"The stuff you said in your intro, how much of it was serious?"
With her arms crossed in front of her chest, lips sealed tight,
Suzumiya Haruhi kept her stern posture, staring right into my eyes.
"What 'stuff in my intro?'"
"The stuff about the aliens and all that."
"Are you an alien?"


OUTPUT:
I turned my head around, with that casual smile all over my face.
``The stuff you said in your intro, how much of it was serious?''
With her arms crossed in front of her chest, lips sealed tight,
Suzumiya Haruhi kept her stern posture, staring right into my eyes.
``What 'stuff in my intro?'''
``The stuff about the aliens and all that.''
``Are you an alien?''


Use whatever language you want. Bonus points for creativity and efficiency.

I'll start:
#include <stdio.h>

char *q[]= {"''", "``"};
main() {
 int c, i=0;
 while((c=getchar())!=EOF) {
  if(c=='"')
   printf("%s",q[i^=1]);
  else
   putchar(c);
 }
}

Name: Anonymous 2008-08-14 0:43

"how do you like "how do you like X meme" meme"

Go ahead and use your puny programs on this.

Name: Anonymous 2008-08-14 8:00

>>48
There's no way to identify whether you're quoting the beginning and end, or whether it's a nested quote. Unless we can assume that quotes always respect exactly the '  "quoted" ' format, as in the quote has no space between the quotation marks and the text, but it does have one before and after the marks - true for your post but not for everyone.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List