@Test public void testRemoveComments() { String s = "no comment"; Assert.assertEquals( s, TextUtils.removeComments( s )); s = "# comment"; Assert.assertEquals( "", TextUtils.removeComments( s )); s = " # no comment"; Assert.assertEquals( "", TextUtils.removeComments( s )); s = " # no comment # "; Assert.assertEquals( "", TextUtils.removeComments( s )); s = " first line #\n # no comment # "; Assert.assertEquals( " first line", TextUtils.removeComments( s )); s = " first line #\n second line\n # no comment # "; Assert.assertEquals( " first line\n second line", TextUtils.removeComments( s )); }
public static String removeComments( String line ) { return line.replaceAll( "\\s*#[^\n]*", "" ); }
TextUtils { public static String removeComments( String line ) { return line.replaceAll( "\\s*#[^\n]*", "" ); } }
TextUtils { public static String removeComments( String line ) { return line.replaceAll( "\\s*#[^\n]*", "" ); } private  TextUtils(); }
TextUtils { public static String removeComments( String line ) { return line.replaceAll( "\\s*#[^\n]*", "" ); } private  TextUtils(); static String removeComments( String line ); static boolean isLineBreak( char c ); static SelectionRange findRegionFromSelection( String fullText, int selectionOffset, int selectionLength ); }
TextUtils { public static String removeComments( String line ) { return line.replaceAll( "\\s*#[^\n]*", "" ); } private  TextUtils(); static String removeComments( String line ); static boolean isLineBreak( char c ); static SelectionRange findRegionFromSelection( String fullText, int selectionOffset, int selectionLength );  }