Created
October 31, 2014 22:44
-
-
Save RX14/f4f8946d49851ba5d300 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int type = 0; | |
if (prefix.contains("!")) { | |
type = 1; | |
if (prefix.contains("@")) { | |
type = 2; | |
} | |
} | |
switch (type) { | |
case 0: | |
name = prefix; | |
break; | |
case 2: | |
int hostIndex = prefix.indexOf("@"); | |
host = prefix.substring(hostIndex + 1); | |
prefix = prefix.substring(0, hostIndex - 1); | |
case 1: | |
int userIndex = prefix.indexOf("!"); | |
name = prefix.substring(0, userIndex - 1); | |
user = prefix.substring(userIndex + 1); | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment