id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

splitA


splitA(string, delimiter): EXTRA-CREDIT This works EXACTLY like the split() function in Javascript! Given a string and a delimiter, split the string into an array of Strings. The delimiter marks the boundaries where you will divide the string. For example, split("first=John&last=Smith","&") will return an array of Strings with two members: {"first=John","last=Smith"). NOTE: You may NOT use the built-in "split()" method that Java provides. HINT: Click on the "help" link, then on "Strings". Search for "findOOP". RUBRIC: It is not enough to just solve the problem. Make sure you use PROPER INDENTATION. You MUST use CURLY BRACKETS for all loops and if/else statements. Also, the more EFFICIENT your solution, the higher your grade. If you have extraneous (superfluous / unnecessary) code, deductions will be taken.


splitA("first=John&last=Smith", "&") → ["first=John", "last=Smith"]
splitA("Joanie Mitchell*Barack Obama*Bob Dylan", "*") → ["Joanie Mitchell", "Barack Obama", "Bob Dylan"]
splitA("abc123def123ghi123jkl123mno123pqr123stu123vwx123yz", "123") → ["abc", "def", "ghi", "jkl", "mno", "pqr", "stu", "vwx", "yz"]

...Save, Compile, Run (ctrl-enter)

public String[] splitA(String str, String delimiter) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 20

Copyright Nick Parlante 2017 - privacy