+ 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.
22 Antworten
+ 12
Can't mark 2 answers as best 😥
https://code.sololearn.com/cpG0m53g0mMc/?ref=app
https://code.sololearn.com/WKXmFgWbDxul/?ref=app
+ 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.
+ 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.
+ 16
@Cedric your code works fine but, you have to use angular brackets 😀
+ 15
@Ipang Yes. PHP is allowed. I just forgot to mention it.
+ 15
+ 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.
+ 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.
+ 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.
+ 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
+ 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
+ 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
+ 7
@kazi its really good try
+ 7
this is updated version of my last Mail Merge code. please comment suggestions and experience. thanks.
https://code.sololearn.com/WG1u77Vn5KtA/?ref=app
+ 6
https://code.sololearn.com/WKNrPvH28ygo/?ref=app
+ 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
+ 4
Hi, this is my try ;)
https://code.sololearn.com/Wvtap7U69Bfy/#html
+ 4
My AngularJs solution: https://code.sololearn.com/WKXmFgWbDxul/?ref=app
It includes the bonus.
Have fun 🙂