Answers for "get last word from string"

11

check last character of string java

String str = "India";
System.out.println("last char = " + str.charAt(str.length() - 1));
Posted by: Guest on March-23-2020
0

Get the First and Last Word from a String or Sentence

DECLARE @Sentence    VARCHAR(MAX) = 'The quick brown fox jumps over the lazy dog'

SELECT SUBSTRING(@Sentence, 1, CHARINDEX(' ', @Sentence) - 1) AS [First Word],
       REVERSE(SUBSTRING(REVERSE(@Sentence), 1,                CHARINDEX(' ', REVERSE(@Sentence)) - 1)) AS [Last Word]
Posted by: Guest on April-30-2021

Code answers related to "get last word from string"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language