さいたん一致再び 2014/03/30


javaです。
こういう感じの文字列があります
aaa=selext * from a where a.x = xxxx

はじめのaaaがsqlidで=のうしろがsqlというような設定から、
sqlidとsqlを抜き出します。

static String[] getSqlidAndSql(String s){ if (s.trim().startsWith("#")) { return null; } String sqlid = s.replaceFirst("(^.*?)=.*", "$1"); String sql = s.replaceFirst(".*?=(.*)", "$1"); return new String[]{sqlid, sql}; }



むっ正しいのかなこれ

: