Solved String Splitting Help

Discussion in 'Spigot Plugin Development' started by Halflove, May 26, 2018.

  1. Hey,

    So I'm trying to check if the data after a ":" in a string exists or not. So I'm basically splitting a string by a ":" character and checking if there is any data after it. This is my code to check that:

    Code (Text):
    String[] cdblock = args[1].split(":");
    if(!cdblock[1].equals(null)){
    I've also tried:

    Code (Text):
    String[] cdblock = args[1].split(":");
    if(!cdblock[1].equalsIgnoreCase("")){
    Both of these methods, however, keep returning with an error and don't work. Any help would be much appreciated! :)
     
  2. Nevermind, I fixed it using a substring:

    Code (Text):
    if(!args[1].substring(args[1].length()-1,args[1].length()).equals(":")){
     
  3. Alright, I was about to say something identical to that!