Click here to watch in Youtube :
https://www.youtube.com/watch?v=RCGzUj99Je8&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java String (substring method) |
Java Tutorial : Java String (substring method) |
/* * public String substring(int beginIndex, int * endIndex) * * Parameters: * ---------- * beginIndex - the beginning index, inclusive. * endIndex - the ending index, exclusive. * * Returns: * ------- * Returns a string that is a substring of this * string. The substring begins at the specified * beginIndex and extends to the character at index * endIndex - 1. Thus the length of the substring is * endIndex-beginIndex. */ public class SubStringDemo1 { public static void main(String[] args) { String str = "Welcome"; String subString = str.substring(3, 6); System.out.println("subString = " + subString); } }
subString = com
/* * public String substring(int beginIndex) * * Parameters: * ---------- * beginIndex - the beginning index,inclusive. * * Returns: * ------- * Returns a string that is a substring of this * string. The substring begins with the character * at the specified index and extends to the end of * this string. */ public class SubStringDemo2 { public static void main(String[] args) { String str = "Welcome"; String subString = str.substring(3); System.out.println("subString = " + subString); } }
subString = come
https://sites.google.com/site/javaee4321/java/StringDemo_SubString_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/StringDemo_SubString_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/a73203f981da1e65b72e10bb91ed595b4f0c377b/BasicJava/StringDemo_SubString_App/?at=master
See also:
No comments:
Post a Comment