Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

write a code to print second last word of input string

String string = "Hai,Hello,How,are,you";
String[] bits = string.split(",");
String lastWord = bits[bits.length - 2];
tvs.setText(lastWord);
Comment

write a code to print second last word of input string

String string = "Hai,Hello,How,are,";
String[] bits = string.split(",", -1);
 ↓
bits[]…{ "Hai","Hello","How","are","" }
bits[bits.length-2]…"are"
Comment

PREVIOUS NEXT
Code Example
Java :: comvertir a java 
Java :: get number value of an output to another script java 
Java :: retrofit interface 
Java :: Java create an object of the static class Mammal 
Java :: java bean go to other page 
Java :: find center of screen graphic g 
Java :: Java @Repeatable 
Java :: java interview question answer 
Java :: how to add data json jaca 
Java :: number pattern in java 
Java :: how to implement count steps in android 
Java :: Java Access Specifier in Overriding 
Java :: Java Program to Print Spiral Pattern of Numbers 
Java :: similar thing as pair in c++ in java 
Java :: open youtube by default in full screen pragmatically in android 
Java :: regex plit string with dash or undescore java 
Java :: buat tetris dari java 
Java :: ASCII PrintWriter java.io examples 
Java :: what is the use of the tolowercase in java 
Java :: The create method: 
Java :: call method of another class without creating instance in java android 
Java :: throws multiple exception 
Java :: java for loop example 
Java :: Using UUID spring boot Neo4J 
Java :: inputstream to bufferedreader 
Java :: How to center a print statement text? 
Java :: zufallszahl java 
Java :: public class BigInteger { public static void main(String args[]) { long p=2147483648; } } 
Java :: how to open a folder in java swing project 
Java :: navigation view item selected 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =