Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Stivan Radev
Stivan Radev
1,475 Points

Best programming language to split these?

So what would be the best language to use to split these 2: First, how do I ignore "|" and "," but keep the rest of stuff? EX: 341 mike l steve l brandon

|341,mike|l,steve|l,brandon|l,jake|l,daniel258585|l,david1100|l,don556|l,drazz99|l,james|l,jaem|l,michaeldixon|l,docks|l,alpha|p,anthony009s|p,smith|p,blubb65|p,polly|p,issa|p,cooper|p,ema|p,train|p,erol|

Second, how would I make this easily readable IF POSSIBLE: EX: Goals:2 Current: 112 / 177 Remaining for Goal #3 Total: 466

{"row1_value": "Goals: 2\u2002\u25cf\u2002Current: 112 / 177", "row3_value": "Remaining for Goal #3:\u200265\u2002\u25cf\u2002Total: 466", "name": "Goals", "template": "3_rows_11_21_31", "row2_value": "Goal Progress:\u2002\u2588\u2588\u2588\u2588\u2588\u2588\u2592\u2591\u2591\u2591\u2002\u25cf\u200263%"}

Thanks!

2 Answers

Steven Parker
Steven Parker
231,275 Points

Any programming language with a decent complement of string and JSON functions would do this kind of thing easily. JavasScript would certainly do, I'm guessing you asked in this category for a reason. So would Python.

And that first task seems simple enough that you could do it with just a decent editor program using the "find and replace" function.

Stivan Radev
Stivan Radev
1,475 Points

I'll try it out, thanks :)

Not going to do the work for you, but use Python.

Problem 1 should be easily doable with the string method split().

Problem 2 will be very easy using the json library.