Skip to content

Instantly share code, notes, and snippets.

@wingyplus
Created October 6, 2016 15:33
Show Gist options
  • Save wingyplus/46c6bda185559c7df399c3d82e105c6d to your computer and use it in GitHub Desktop.
Save wingyplus/46c6bda185559c7df399c3d82e105c6d to your computer and use it in GitHub Desktop.
package io.github.wingyplus;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* Created by wingyplus on 10/6/2016 AD.
*/
public class StringTest {
@Test
public void replaceCharacter() {
String s = "text^^after new line";
String snew = s.replace(new StringBuffer("^^"), new StringBuffer("\n"));
assertEquals("text\nafter new line", snew);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment