I have a long string and I split it by space character, in some parts there are more than one space so a space gets to become a string. I have created a for loop and trying to identify those space strings to skip them but unfortunately they cannot be found by the code that I'm using.
public static void main( String[] args ){
String s = "Monday Tuesday Wednesday 8:00 8:15 8:30 8:45 9:00 9:15 9:30 9:45 10:00 IT Service Mgt. F1.2 wkFeb2-wkMar23, wkApr13-wkMay11 IT Service Mgt. B180 wkFeb2-wkMar23, wkApr13-wkMay11 Strategic IT Mgt. F1.2 wkFeb2-wkMar23, wkApr13-wkMay11 10:15 10:30 10:45 11:00 Strategic IT Mgt. B145 wkFeb2-wkMar23, wkApr13-wkMay11 11:15 11:30 11:45 12:00 12:15 12:30 12:45 13:00 IT Service Mgt. B145 wkFeb2-wkMar23, wkApr13-wkMay11 IT Service Mgt. E7 wkFeb2-wkMar23, wkApr13-wkMay11 13:15 13:30 13:45 14:00 Sec. Penetration Testing B251 wkFeb2-wkMar23, wkApr13-wkMay11 Ent. Storage Sys. C129 wkFeb2-wkMar23, wkApr13-wkMay11 14:15 14:30 14:45 15:00 Ent. Storage Sys. C129 wkFeb2-wkMar23, wkApr13-wkMay11 15:15 15:30 15:45 16:00 Sec. Penetration Testing C136 wkFeb2-wkMar23, wkApr13-wkMay11 Ent. Storage Sys. C134x wkFeb2-wkMar23, wkApr13-wkMay11 16:15 16:30 16:45 17:00 17:15 17:30 17:45 ";
String[] parts = s.split(" ");
String space = " ";
for(int i=0; i<parts.length;i++)
{
if(parts[i].charAt(0) == ' ')
{
System.out.println("askdfhlghlaksjdgsdasasfasfasdfasd");
}
if(parts[i].compareTo(" ")==0){
System.out.print("asdfghgfdsaASDFGHGFDSASDFGHJKJHGFDSASDFGHJKJHGTFRD");
}
System.out.print(parts[i]);
}
}