Solved

Dividing an input string into two strings.. JAVASCRIPT

Posted on 2016-10-06
3
32 Views
Last Modified: 2016-11-09
This is a homework question that I couldn't solve, the coding I wrote keeps giving me an error.
Using the Scanner, input a string that contains a single exclamation mark.
Divide the input string into two strings, one before and the other after the
exclamation mark, and output them. Do not include the exclamation mark in
the output. For example, if the input string is one potato two potato !three,
then the output would be
one potato two potato
three
0
Comment
Question by:ahmet buyuknahirci
  • 2
3 Comments
 
LVL 54

Expert Comment

by:Julian Hansen
ID: 41832766
Lookup the JavaScript function split().
0
 
LVL 54

Accepted Solution

by:
Julian Hansen earned 500 total points (awarded by participants)
ID: 41853427
var str = "one potato two potato !three";
var newstr = str.split('!');
console.log(newstr);

Open in new window

0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question