Comment detail

/*コメント*/を取り除く (Nested Flatten)

実行結果は以下のようになりました。

>>> removeComment('AAA')
'AAA'
>>> removeComment('AAA/*BBB*/')
'AAA'
>>> removeComment('AAA/*BBB')
'AAA'
>>> removeComment('AAA/*BBB*/CCC')
'AAACCC'
>>> removeComment('AAA/*BBB/*CCC*/DDD*/EEE')
'AAADDD*/EEE'
>>> removeComment('AAA/a//*BB*B**/CCC')
'AAA/a/CCC'
1
2
3
def removeComment( text ){
    println text.replaceAll(/(\/\*.*?\*\/)|(\/\*.*$)/, "")
}

Index

Feed

Other

Link

Pathtraq

loading...