我有这个款之后(可能是我有一个以上的段落)截断前行和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