+ 27

[๐Ÿ† CHALLENGE ๐Ÿ†] :: MAIL MERGE ๐Ÿ“ง๐Ÿ“ง๐Ÿ†๐Ÿ†

Challenge #1 Let's make a program to do mail merge. Sample Case: Table -> Name Surname Level 1 AB CD 4 2 EF GH 16 3 XY Z 9 String -> "Hello <Name> <Surname>! You are at level <Level>" Output-> "Hello AB CD! You are at level 4" "Hello EF GH! You are at level 16" "Hello XY Z! You are at level 9" Bonus: Make the code in such a way that user-defined fields will work in the mail merge. Happy coding.

23rd Dec 2017, 9:17 AM
Swapnil Srivastava
Swapnil Srivastava - avatar
22 Answers
25th Dec 2017, 4:27 AM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 16
It would be better if you don't input the table. You can store the table as an array. And you can put your own values in the table. And for the string you may or may not use input. Your choice.
23rd Dec 2017, 10:46 AM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 16
And you should store the table in a 2D array in such a way that if any new field is added to it then it also works.
23rd Dec 2017, 12:57 PM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 16
@Cedric your code works fine but, you have to use angular brackets ๐Ÿ˜€
24th Dec 2017, 4:32 AM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 15
@Ipang Yes. PHP is allowed. I just forgot to mention it.
23rd Dec 2017, 1:55 PM
Swapnil Srivastava
Swapnil Srivastava - avatar
23rd Dec 2017, 9:18 PM
LukArToDo
LukArToDo - avatar
+ 15
@H Chiang No, you don't have to do that. A string is to be taken( you may or may not input it) which has values in angular brackets (<>) and it has to replace them with the values in the table. Eg. "hello <Name>" should be replaced with all the names in the table.
24th Dec 2017, 4:24 AM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 13
@Kazi the challenge is not to print random strings but to replace the values in angular brackets with the values in the table. The main challenge is to do the angular brackets part.
23rd Dec 2017, 12:55 PM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 12
@Kazi the input has to be a string with the table values kept in angular brackets. Eg: "Hello <name>" It has to replace the <name> with the name in the table for every value in the table. Hope you understood.
23rd Dec 2017, 2:27 PM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 11
Hello everyone. Thanks for your participation in this challenge. It's time for my next challenge. Hope you will like that as well๐Ÿ˜€. https://www.sololearn.com/discuss/959489/?ref=app
27th Dec 2017, 1:59 PM
Swapnil Srivastava
Swapnil Srivastava - avatar
23rd Dec 2017, 8:20 PM
Ferhat Sevim
Ferhat Sevim - avatar
+ 10
Here's my C# implementation! โœŒ Glad to completed a few challenges before Christmas! Thank you @Swapnil for the interesting challenge and I hope you all enjoy it~ โค https://code.sololearn.com/cpG0m53g0mMc/?ref=app
24th Dec 2017, 4:58 AM
Zephyr Koo
Zephyr Koo - avatar
+ 7
@Swapnil Srivastava, Is PHP allowed to submit? I didn't see it in the tags, just wanted confirmation : ) (Edit) Thank you! here's my attempt : ) https://code.sololearn.com/wFkn3FxxOibF/?ref=app
23rd Dec 2017, 1:40 PM
Ipang
+ 7
@kazi its really good try
23rd Dec 2017, 5:59 PM
Mohammad Asif Abrar Sayim
Mohammad Asif Abrar Sayim - avatar
+ 7
this is updated version of my last Mail Merge code. please comment suggestions and experience. thanks. https://code.sololearn.com/WG1u77Vn5KtA/?ref=app
28th Dec 2017, 5:41 AM
raz
raz - avatar
+ 6
https://code.sololearn.com/WKNrPvH28ygo/?ref=app
23rd Dec 2017, 12:29 PM
Pranta Saha
Pranta Saha - avatar
23rd Dec 2017, 6:07 PM
Kodirbek Makharov
Kodirbek Makharov - avatar
+ 6
I think I kinda have a difficulty understanding the question. The table is hard coded, user inputs the preferred output format (string part, in your example), and the app should print data, as user has ordered ? like in your example, if we change the input to " <Name>, hi ! <level> is your level" the output changes into this format, not using the <Surname> column at all. Am I right ? If so, this is my answer, by changing @kazi 's code a little. https://code.sololearn.com/c2Ot7WKwnrAu
23rd Dec 2017, 6:50 PM
Sina Seirafi
Sina Seirafi - avatar
24th Dec 2017, 1:35 AM
Cรฉdric Degrelle
Cรฉdric Degrelle - avatar
+ 4
My AngularJs solution: https://code.sololearn.com/WKXmFgWbDxul/?ref=app It includes the bonus. Have fun ๐Ÿ™‚
24th Dec 2017, 6:34 PM
Luc Hariman Randrianomenjanahary
Luc Hariman Randrianomenjanahary - avatar