in reply to C to Java string conversion script
Hmm... Not sure why you'd want this, but anyway. Here's a one-liner that does it, but broken out for clarity:
Main difference is that this will match many quoted strings on a line. Like your example, it won't cope with "escaped \" quotes".while (<>) { s|"([^"]+)"| '{' . join(',', map { "(byte)'$_'" } split(//, $1) ) . '}' |gex; print; }
HTH
|
|---|