Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Re: C vs perl

by czrdup (Acolyte)
on Apr 29, 2002 at 17:42 UTC ( [id://162877]=note: print w/replies, xml ) Need Help??


in reply to Re: C vs perl
in thread C vs perl

I did some thinking and the best I could come up with in a short amount of time is this:
char* destroycrlf(char* original) { char *ret, *token, sep[] = "\r"; ret = (char *)calloc(strlen(original) * 7 + 8,sizeof(char)); token = strtok( original, sep ); sprintf(ret ,"<p>" ); while (token) { if (token[0] == '\n') sprintf(ret, "%s<\\p><p>%s", ret, &token[1]); else sprintf(ret, "%s%s", ret, token); token = strtok( NULL, sep ); } sprintf(ret, "%s<\\p>", ret); return ret; }
Maybe not the shortest, but it should work and is fairly quick.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://162877]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (7)
As of 2024-03-28 21:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found