You are viewing a single comment's thread from:

RE: Programming Challenge 1 : Break it down further

in #steemgig8 years ago (edited)

The site you mention doesn't allow JavaScript input, probably because you don't need a website to parse JS (the developer console in any browser is enough). Do you still accept JavaScript solutions?

Also, in which format do you want the output? Should it be with the horizontal lines between it, like in your posts? Or just single line returns like this:

First sentence of first paragraph. Second sentence of first paragraph.
First sentence of first paragraph. 
First
sentence
of
etc...
Sort:  

Yes. Please share a link to the website where your code can be run. We can update the post with the link that website.
Singe line results should do. It was added just for the sake of clarity. We can accept both as answer I think.

Sorry, I was in a meeting. Took me about 10 minutes to code this, I can make the code prettier if you like but I think it does exactly what you asked. https://jsfiddle.net/zpyn1f56/1/

@pilcrow Great. Upvoted with 100 %. Can you retry doing this using recursion? That way we can just pass the delimiters and the level, the program should break it upto nth level.

The delimiter changes each time, so recursion doesn't seem like a good option to me. In fact, the only difference between a paragraph, a line and a word is which delimiter it uses. If I did this recursively I can't think of a way to reliably break up the content into increasingly smaller chunks.

By the way, is this a contest or your homework I'm solving? ;)

I already have used this in https://steemit.com/languages/@gokulnk/learning-german-using-google-spreadsheets

I wanted to know if there was a better way of doing this. Hence posted this as a contest.

@pilcrow do let me know if you would be interested in collaborating on https://steemit.com/qa/@gokulnk/q-a-site-based-on-steem-brainstorming. If you are interested we can catch up on steemit chat.

Sorry, I'm already working on two Steemit apps and one other app in my free time (plus 40 hours a week programming for my job). I think I won't have time to collaborate at least until 2018 :)