Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

delete ending part of the string java

//To delete starting from "opened"
String str ="13 opened by someone";

String result = str.substring(0,str.lastIndexOf(" opened"));
Comment

Delete end element in string java

public String method(String str) {
    if (str != null && str.length() > 0 && str.charAt(str.length() - 1) == 'x') {
        str = str.substring(0, str.length() - 1);
    }
    return str;
}
Comment

remove part of string java

// Works only if you have a certain character at which you want to cut
String text = "Image.png";

String[] cutText = text.split(".");

// cutText[0] has value "Image"
// cutText[1] has value "png"
Comment

PREVIOUS NEXT
Code Example
Java :: key listener java 
Java :: foreach java 
Java :: main methode java 
Java :: selenium java wait for page load 
Java :: java change text on click 
Java :: java string format thousand separator 
Java :: java arraylist to array 
Java :: java double format 
Java :: convert bytebuffer to string 
Java :: java isolate the numbers from string 
Java :: android studio, not loading url in webview 
Java :: how to declare an array in java 
Java :: check whether a double is not a number in java 
Java :: java print hello world 
Java :: android dialog 
Java :: JAVA HashMap get keys by values 
Java :: Why should we mention a method throws some exception/s? 
Java :: how to make a copy of an array java 
Java :: flow dependency android 
Java :: intent flag clear task 
Java :: java list distinct by key 
Java :: input array in String in java 
Java :: sqlite java gradle 
Java :: java.lang.RuntimeException: Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules guava-20.0.jar (com.google.guava:guava:20.0) and listenablefuture-1.0.jar (com.google.guava:listenablefuture:1.0) 
Java :: pretty print json in console 
Java :: next greater permutation leetcode 
Java :: java get JComboBox value 
Java :: Instant class java 
Java :: Java Insert Elements to HashSet 
Java :: android application class manifest 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =