7 kyu

Credit Card Mask

70,040 of 199,301samranjbari

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

Stats:

CreatedSep 12, 2014
PublishedSep 16, 2014
Warriors Trained372560
Total Skips26470
Total Code Submissions539536
Total Times Completed199301
JavaScript Completions80388
Haskell Completions1814
Ruby Completions6144
C# Completions16032
Python Completions70040
CoffeeScript Completions176
Crystal Completions52
Java Completions21113
Rust Completions1711
Swift Completions1164
Perl Completions83
C Completions1688
D Completions14
BF Completions34
Scala Completions175
TypeScript Completions2178
Factor Completions10
COBOL Completions10
Julia Completions20
PHP Completions244
Kotlin Completions146
Total Stars1938
% of votes with a positive feedback rating90% of 17980
Total "Very Satisfied" Votes14696
Total "Somewhat Satisfied" Votes3059
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