Created
July 19, 2016 01:29
-
-
Save morishjs/48a762910b5b49145e553f8046c0736c to your computer and use it in GitHub Desktop.
StringTokenizer vs split
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
package Java0719_api; | |
import java.util.StringTokenizer; | |
/** | |
* Created by Junsuk on 2016-07-19. | |
*/ | |
public class Java128_StringTokenizer { | |
public static void main(String[] args) { | |
StringTokenizer st = new StringTokenizer("java,,jsp", ","); | |
System.out.println(st.countTokens()); | |
while(st.hasMoreTokens()){ | |
System.out.println(st.nextToken()); | |
} | |
String[] data = "java,,jsp/spring".split("[,/]"); | |
System.out.println("countToken: " + data.length); | |
for (String ss: data | |
) { | |
System.out.println(ss); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment