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

[prog-challenge] In-Place URL Encoding

Name: Anonymous 2009-01-17 7:23

Using the encoding ranges specified in the following function

URLencode(char *out, char *in) {
 char a;
 while((a=*in)) {
  if((a>='A')&&(a<='Z')||(a>='a')&&(a<='z')||(a>='0')&&(a<='9')||(a=='-')||
     (a=='_')||(a=='.')||(a=='~')) {
   *(out++) = a;
  } else {
   sprintf(out,"%%%02x",a);
   out+=3;
  }
  in++;
 }
 *out=0;
}


Write an equivalent function which can URL-encode a string in-place, i.e. assuming the buffer is large enough (thrice the length of the original string), a call such as URLencode(str) will write the URL-encoded version in the same buffer, possibly lengthened to up to thrice its original length.

Your function cannot use any additional storage space that grows proportionally with the length of the string. The smallest, fastest, and most efficient implementations win.

Name: Anonymous 2009-01-17 11:26

>>30
Let's say you're still missing the point of the entire thread and any post in it. You just can't admit, that your silly javascript-function is totally misplaced here and now you're trying to avoid topic by distracting from that original post. But your puny little attempts won't work here.
Unless you're really convinced you did something right there. But nobody can be that stupid.

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