13 May 2009

schema.table to "schema"."table"

PHP

<?php
$st = 'schema.table';
print join('.', array_map(create_function('$a', 'return \'"\'.$a.\'"\';'), explode('.', $st)));

Selected 3 of 3 Lines; 11 of 11 Words; 124 of 124 Bytes

Python

st = 'schema.table'
print '.'.join('"'+i+'"' for i in st.split('.'))

Selected 2 of 2 Lines; 9 of 9 Words; 69 of 69 Bytes

Python=PHP/2

1 comment:

Ikhwan Hayat said...

var st = "schema.table";
var st2 = "\"" + st.Replace(".", "\".\"") + "\"";