Substring


public class SubStringDemo {
  public static void main(String[] av) {
    String a = "Java is great.";
    System.out.println(a);
    String b = a.substring(5);  // b is the String "is great."
    System.out.println(b);
    String c = a.substring(5,7);// c is the String "is"
    System.out.println(c);
    String d = a.substring(5,a.length());// d is "is great."
    System.out.println(d);
  }
}
Home 
  Java Book 
    Runnable examples  

Data Type String:
  1. Compare String with compareTo method
  2. Compare strings ignoring case
  3. Compare Strings with equals
  4. Compare string with a StringBuffer
  5. Convert Primitive Type Value to a String
  6. Convert String value to byte
  7. Convert String to primitive byte by parseByte
  8. Convert String to byte
  9. Convert String to byte array
  10. Convert String to Boolean
  11. Convert string to char array
  12. Convert String to double
  13. Convert String to float
  14. Convert binary string into integer
  15. Convert String to int
  16. Convert String to Long
  17. Convert a string to a number
  18. Convert String to Short
  19. Convert hex String To Byte Array
  20. Convert Octal string to integer
  21. Convert String to Lower Case
  22. Convert String to Upper Case
  23. Convert string to uppercase for a Locale
  24. Convert characters in a string to a Set
  25. Capitalize/Uncapitalize the first character converted to uppercase
  26. Capitlize each word in a string (journal titles, etc)
  27. Count letters in a String
  28. Count numbers in a String
  29. Count the number of occurrences of character c in a string.
  30. Check each char value from a string
  31. Count substring Occurrences
  32. Convert char in a String to Ascii code
  33. Convert Character array to String
  34. Encode a string in UTF-8
  35. Encode string in UTF-8 byte[]
  36. Encode UTF-8 from Unicode
  37. Escape string
  38. Format strings into table
  39. Format string to Center
  40. Justify left string
  41. Justify right string
  42. Length of things
  43. Hash Code String
  44. Is String is a Legal Java Identifier
  45. Is String empty (""), null and whitespace
  46. Is a string a palindrome
  47. Pad right a string
  48. Pad left a string
  49. Remove a substring
  50. Remove leading white space from a string
  51. Remove specified chars from a string
  52. Remove trailing whitespace
  53. Replace Characters in a String
  54. Replace multiple whitespaces between words with single blank
  55. Replace first occurrences of given String with new one
  56. Replace all occurrences of given String with new one and returns new String object.
  57. Replace new line sign
  58. Replace a character at a specified position
  59. Reverse a string
  60. Search a substring
  61. Search a Substrings for First occurrence
  62. Search a substring for Last occurrence
  63. Search substring anywhere, ignore case( regular expressions )
  64. ends With string
  65. Ends with, ignore case( regular expressions )
  66. starts With string
  67. Starts with, ignore case( regular expressions )
  68. starts with a digit or uppercase letter
  69. Split string by a whitespace character
  70. Split string by space
  71. Split string by - (hyphen)
  72. Split string by dot
  73. Split string by | (bar)
  74. Split string by , (comma)
  75. Split string for the maximum number of substrings
  76. Split with regular expression
  77. Split string by Pattern for space splittor
  78. Split Strings with -/%s
  79. Split string on word boundaries.
  80. Split string on commas and zero or more spaces.
  81. Split string on word boundaries, but allow embedded periods and @.
  82. Split string on punctuation and zero or more trailing spaces.
  83. Split string with and's and or's
  84. Sort string array in case insensitive order and case sensitive order
  85. Substring
  86. Trim leading and trailing space from String
  87. Trim double quotes
  88. Unquote string
  89. Wrap Word
  90. Break Lines
  91. Abbreviates a String using ellipses.
  92. Delimit a string
  93. Unaccent letters