6 kyu

Create Phone Number

127,414 of 350,958xDranik

Description:

Write a function that accepts an array of 10 integers (between 0 and 9), that returns a string of those numbers in the form of a phone number.

Example

createPhoneNumber([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) // => returns "(123) 456-7890"
createPhoneNumber(int[10]{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}) // => returns "(123) 456-7890"
create_phone_number([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) # => returns "(123) 456-7890"
createPhoneNumber([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) # => returns "(123) 456-7890"
createPhoneNumber([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) # => returns "(123) 456-7890"
Kata.createPhoneNumber(new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}) // => returns "(123) 456-7890"
createPhoneNumber([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) // => returns "(123) 456-7890"
createPhoneNumber [1,2,3,4,5,6,7,8,9,0] -- => returns "(123) 456-7890"
Kata.CreatePhoneNumber(new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}) // => returns "(123) 456-7890"
createPhoneNumber [1; 2; 3; 4; 5; 6; 7; 8; 9; 0] // => returns "(123) 456-7890"
create_phone_number([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) # => returns "(123) 456-7890"
Kata.createPhoneNumber(Seq(1, 2, 3, 4, 5, 6, 7, 8, 9, 0)) # => returns "(123) 456-7890"
createPhoneNumber([1,2,3,4,5,6,7,8,9,0]); // => returns "(123) 456-7890"
createPhoneNumber [1; 2; 3; 4; 5; 6; 7; 8; 9; 0] // => returns "(123) 456-7890"
(create-phone-number [1 2 3 4 5 6 7 8 9 0]) ;; => returns "(123) 456-7890"
create_phone_number(&[1,2,3,4,5,6,7,8,9,0]); // returns "(123) 456-7890"
CreatePhoneNumber([10]uint{1,2,3,4,5,6,7,8,9,0})  // returns "(123) 456-7890"
create_phone_number(phnum, (const unsigned char[]){1,2,3,4,5,6,7,8,9,0});
    /* phnum <- "(123) 456-7890" */
phnum:  resb 15
nums:   db  1,2,3,4,5,6,7,8,9,0

mov rdi, phnum
mov rsi, nums
call create_phone_number  ; RAX <- phnum <- "(123) 456-7890" 
createPhoneNumber([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) // => returns "(123) 456-7890"
createphonenumber([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) # -> returns "(123) 456-7890"
createPhoneNumber( [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] ) // => returns "(123) 456-7890"
{ 1 2 3 4 5 6 7 8 9 0 } create-phone-number ! returns "(123) 456-7890"
create_phone_number({ 1,2,3,4,5,6,7,8,9,0 }) -- => returns "(123) 456-7890"

The returned format must be correct in order to complete this challenge.

Don't forget the space after the closing parentheses!

Arrays
Strings
Regular Expressions
Algorithms

Similar Kata:

Stats:

CreatedOct 17, 2013
PublishedOct 17, 2013
Warriors Trained596964
Total Skips48084
Total Code Submissions808693
Total Times Completed350958
JavaScript Completions127414
CoffeeScript Completions334
Ruby Completions9142
Java Completions39656
Dart Completions2107
Haskell Completions1813
C# Completions22755
Python Completions115677
Scala Completions967
Groovy Completions157
Crystal Completions67
PowerShell Completions316
Go Completions4589
C Completions4539
NASM Completions63
Rust Completions3274
PHP Completions6642
Clojure Completions408
C++ Completions14218
Julia Completions170
CFML Completions43
Factor Completions20
F# Completions99
COBOL Completions38
Lua Completions333
TypeScript Completions4220
BF Completions52
Total Stars3755
% of votes with a positive feedback rating85% of 28359
Total "Very Satisfied" Votes20895
Total "Somewhat Satisfied" Votes6522
Total "Not Satisfied" Votes942
Ad
Contributors
  • xDranik Avatar
  • jhoffner Avatar
  • Unnamed Avatar
  • GiacomoSorbi Avatar
  • Jotha Avatar
  • lessonteacher Avatar
  • andreapt82 Avatar
  • kodejuice Avatar
  • gttotev Avatar
  • AntonRatnick Avatar
  • aweleshetu Avatar
  • eXeC64 Avatar
  • romerojp Avatar
  • Chrono79 Avatar
  • kazk Avatar
  • ThorstenLudwig Avatar
  • Voile Avatar
  • Souzooka Avatar
  • AndyGauge Avatar
  • fivemoreminix Avatar
  • danmbyrd Avatar
  • FArekkusu Avatar
  • bdw429s Avatar
  • vp217 Avatar
  • hobovsky Avatar
  • Console Cowboy Avatar
  • cliffstamp Avatar
  • uniapi Avatar
  • stellartux Avatar
  • trashy_incel Avatar
  • user8436785 Avatar
  • zLuki Avatar
  • ejini战神 Avatar
  • user2058606 Avatar
  • akar-0 Avatar
  • Kacarott Avatar
  • Just4FunCoder Avatar
  • sid114 Avatar
  • jeydo6 Avatar
  • fcr-- Avatar
Ad