我有這個款之後(可能是我有一個以上的段落)截斷前行和cariage回報( R)或新行( n)的用省略號
=> "On the server side,\n\nmy EJB3 application uses Spring for configuring all sorts of things. So,\n\nmy EJBs all look up various ApplicationContexts and use them as a sort of\r\nwell, I was going to say poor man's JNDI, but the reality is that JNDI in the J2EE environment is really a poor man's Spring. :-)\n\nOn the GUI side,\n\nI use it instead of resource injection to get access to my EJBs.\n\nThat lets me test the GUI component with simple pojos.\n\nHope that helps."
上irb
,我分配成x
x = %q{On the server side,\n\nmy EJB3 application uses Spring for configuring all sorts of things. So,\n\nmy EJBs all look up various ApplicationContexts and use them as a sort of\r\nwell, I was going to say poor man's JNDI, but the reality is that JNDI in the J2EE environment is really a poor man's Spring. :-)\n\nOn the GUI side,\n\nI use it instead of resource injection to get access to my EJBs. \n\nThat lets me test the GUI component with simple pojos.\n\nHope that helps.}
按回車(\ r)和新行(\ n)的,我只需要這些從上面的段落細節,任何想法我怎麼能這樣做?
my EJB3 application uses Spring for configuring all sorts of things. So,...my EJBs all look up various ApplicationContexts and use them as a sort of...I use it instead of resource injection to get access to my EJBs....
很簡單的辦法 - 讓我們說我有a\nabc\r\nd\r\nab\neba
和搜索關鍵字爲b
,我只需要abcabeba
@sawa - 比方說我的關鍵字是' EJB',所以我需要截斷最近的\ r或\ n這個單詞,例如 - 這裏是字符串a \ nabc \ r \ nd \ r \ nab \ neba和search關鍵字是「b」,我只需要abcabeba – 2013-04-24 17:52:36
@sawa也更新問題 – 2013-04-24 17:59:11
@sawa - 是基於 – 2013-04-24 18:04:10