Java String.startsWith() The method startsWith() is a convenience method that checks whether a String starts with another String. We can also pass the index of the first character to start checking from. Available Signatures [source,java,gutter:,false] public boolean startsWith(String prefix) public boolean startsWith(String prefix, int toffset) Example [source,java,gutter:,true] @Test public void… Continue Reading starts-with

Java String.substring() The method substring() comes with two signatures. If we pass the beginIndex and the endIndex to the method, then it obtains a part of a String given the starting index and the length of the result. We can also pass the beginIndex only and obtain the part of… Continue Reading substring

Java String.replaceAll() The method replaceAll() replaces all occurrences of a String in another String. Available Signatures [source,java,gutter:,false] public String replaceAll(String regex, String replacement) Example [source,java,gutter:,true] @Test public void whenCallReplace_thenCorrect() { String s = “I learn Spanish”; assertEquals(“I learn French”, s.replaceAll(“Spanish”, “French”)); }

Guide to Unix Swap 1. Introduction In this tutorial, we’ll introduce the Unix swap space, its advantages, and a few simple commands to manage it. 2. The Unix Swap Space Swap or paging space is basically a portion of the hard disk that the operating system can use as an… Continue Reading swap-space

Java String.trim() The method trim() removes any whitespace at the beginning and at the end of a String. If the String contains only spaces, then the method returns an empty String. Available Signatures [source,java,gutter:,false] public String trim() Example [source,java,gutter:,true] @Test public void whenTrim_thenCorrect() { assertEquals(“foo”, ” foo “.trim()); }