7 kyu

Credit Card Mask

79,472 of 196,752samranjbari

Description:

Usually when you buy something, you're asked whether your credit card number, phone number or answer to your most secret question is still correct. However, since someone could look over your shoulder, you don't want that shown on your screen. Instead, we mask it.

Your task is to write a function maskify, which changes all but the last four characters into '#'.

Examples (input --> output):

"4556364607935616" --> "############5616"
     "64607935616" -->      "#######5616"
               "1" -->                "1"
                "" -->                 ""

// "What was the name of your first pet?"
"Skippy" --> "##ippy"
"Nananananananananananananananana Batman!" --> "####################################man!"
Strings
Algorithms

Similar Kata:

Stats:

CreatedSep 12, 2014
PublishedSep 16, 2014
Warriors Trained367752
Total Skips26209
Total Code Submissions534123
Total Times Completed196752
JavaScript Completions79472
Haskell Completions1808
Ruby Completions6124
C# Completions15879
Python Completions69060
CoffeeScript Completions176
Crystal Completions52
Java Completions20874
Rust Completions1677
Swift Completions1150
Perl Completions79
C Completions1628
D Completions14
BF Completions34
Scala Completions171
TypeScript Completions2059
Factor Completions10
COBOL Completions10
Julia Completions20
PHP Completions195
Kotlin Completions116
Total Stars1920
% of votes with a positive feedback rating90% of 17870
Total "Very Satisfied" Votes14605
Total "Somewhat Satisfied" Votes3040
Total "Not Satisfied" Votes225
Ad
Contributors
  • samranjbari Avatar
  • jhoffner Avatar
  • xcthulhu Avatar
  • domgetter Avatar
  • user2861271 Avatar
  • bkaes Avatar
  • Unnamed Avatar
  • Deantwo Avatar
  • MMMAAANNN Avatar
  • jmunsch Avatar
  • JDeBolt Avatar
  • Brettm12345 Avatar
  • Chrono79 Avatar
  • imjasonmiller Avatar
  • nekokat Avatar
  • Voile Avatar
  • Madjosz Avatar
  • Souzooka Avatar
  • yuxuanchiadm Avatar
  • booniepepper Avatar
  • hobovsky Avatar
  • neoncitylights Avatar
  • trashy_incel Avatar
  • kirull Avatar
  • user8436785 Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
  • pastre Avatar
  • Kacarott Avatar
  • Just4FunCoder Avatar
  • josdem Avatar
  • airshawn Avatar
  • LearningFTW Avatar
  • ABS-12 Avatar
  • jpssj Avatar
  • gifti Avatar
  • KayleighWasTaken Avatar
  • Leo_768 Avatar
Ad