| Bytes | Lang | Time | Link |
|---|---|---|---|
| 004 | Vyxal 3 | 250429T095237Z | Themooni |
| 082 | Swift 6 | 250428T181329Z | macOSist |
| 035 | Tcl | 171101T134700Z | sergiol |
| 003 | Thunno 2 J | 230611T141742Z | The Thon |
| 030 | Octave | 221024T090213Z | Stewie G |
| 004 | 05AB1E | 170112T144347Z | Magic Oc |
| 007 | Pyth | 170329T131904Z | KarlKast |
| 053 | Python 3 | 220515T053758Z | Sapherey |
| 022 | Zsh | 190831T233613Z | GammaFun |
| 044 | Python 3 | 220427T125539Z | Sapherey |
| 041 | Excel Insider Beta v2203+ | 220427T101653Z | Taylor R |
| 064 | JavaScript | 220427T050051Z | Matthew |
| 035 | TECO | 220426T213032Z | LdBeth |
| 003 | Vyxal s | 220424T022409Z | naffetS |
| 030 | Factor | 220219T235624Z | chunes |
| 032 | J | 220219T224909Z | sinvec |
| 055 | Python 3 | 211012T175831Z | Larry Ba |
| 047 | Scala 2.12 | 201118T175517Z | user |
| 010 | Pip | 200904T035732Z | Razetime |
| 044 | Julia 1.0 | 190903T151826Z | gggg |
| 024 | Perl 5 a | 190903T151137Z | Xcali |
| 043 | Python 3 | 190903T090255Z | Divy |
| 061 | brainfuck | 190903T072324Z | Dorian |
| 004 | Japt P | 181230T142515Z | Shaggy |
| 033 | Python 3 | 190901T000140Z | Joel |
| 011 | K ngn/k | 190103T073856Z | mkst |
| 061 | C# Visual C# Interactive Compiler | 181229T183836Z | Gymhgy |
| 018 | K4 | 181229T131358Z | mkst |
| 004 | 05AB1E legacy | 181223T133758Z | krinisto |
| 054 | Bash Pure | 181223T142100Z | F. Hauri |
| 024 | Perl 6 | 181223T115248Z | Jo King |
| 048 | Powershell | 181223T101738Z | mazzy |
| 079 | Common Lisp | 180902T202746Z | Renzo |
| 024 | Gol><> | 180902T195102Z | Gegell |
| 040 | Julia 1.0 | 180902T162106Z | Rustem B |
| 027 | Perl | 180902T144721Z | scytale |
| 011 | Deorst | 171107T075434Z | caird co |
| 022 | q/kdb+ | 171101T145841Z | mkst |
| 046 | Python | 141224T071913Z | globby |
| 115 | AHK | 170329T151727Z | Engineer |
| nan | 140725T212018Z | edc65 | |
| 019 | GNU Sed | 170112T194540Z | zeppelin |
| 5615 | REXX | 170112T143357Z | idrougge |
| 045 | Erlang | 141224T070111Z | c.P.u1 |
| nan | 140726T022719Z | ballesta | |
| 059 | Lua | 141005T113357Z | Jim Bauw |
| 011 | CJam | 141005T050355Z | Dennis |
| 103 | QBasic | 141005T034002Z | DLosc |
| 057 | Clojure 63 or | 140806T001236Z | Yosemite |
| 025 | Bash+common linux utils | 140725T202442Z | Digital |
| 025 | Bacchus | 140728T093555Z | Averroes |
| 060 | Java 8 | 140728T082226Z | Roy van |
| 064 | Groovy | 140728T080821Z | markusw |
| 061 | PHP | 140728T075053Z | Christop |
| 032 | Ruby | 140725T181115Z | Kroltan |
| 111 | JavaScript | 140727T222138Z | wolfhamm |
| 015 | APL | 140727T174210Z | marinus |
| 023 | J | 140727T173358Z | marinus |
| 049 | Run Length Encoded Brainfuck | 140727T161107Z | Hjulle |
| 049 | Powershell | 140725T193804Z | fuandon |
| nan | 140726T171845Z | Ian D. S | |
| 063 | C | 140725T213651Z | bebe |
| 022 | x86 machine code on DOS | 140726T171208Z | Matteo I |
| 062 | NodeJS – | 140726T141028Z | c.P.u1 |
| nan | Python shell 40 chars | 140725T174900Z | James Wi |
| 021 | Golfscript | 140726T005020Z | A Frayed |
| 049 | PowerShell | 140725T220459Z | Joey |
| 032 | Perl | 140725T194036Z | hmatt1 |
| 012 | Pyth | 140725T205109Z | izzyg |
| 023 | GolfScript | 140725T185835Z | Cristian |
| 052 | Mathematica | 140725T181256Z | Martin E |
Vyxal 3, 4 bytes
⌈¨bO
⌈¨bO
⌈ # split on spaces
¨b # convert each to decimal
O # decimal to unicode
💎
Created with the help of Luminespire.
<script type="vyxal3">
⌈¨bO
</script>
<script>
args=[["1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100"]]
</script>
<script src="https://themoonisacheese.github.io/snippeterpreter/snippet.js" type="module"/>
Swift 6, 82 bytes
let b={($0+"").split{$0==" "}.map{"\(UnicodeScalar(Int($0,radix:2)!)!)"}.joined()}
Tcl, 35 bytes
proc B s {binary f B* [join $s ""]}
proc B s {binary f B* [regsub -all " " $s ""]}
proc B s {binary format B* [regsub -all " " $s ""]}
Thunno 2 J, 3 bytes
OḂC
But, if a list of strings was an allowed input format:
Thunno 2 J, 2 bytes
ḂC
Explanation
OḂC # Implicit input
O # Split on spaces
Ḃ # Convert from binary
C # Convert to characters
# Implicit output
Octave, 30 bytes
Nothing too fancy, but it's relatively short
@(x)['',bin2dec(strsplit(x))']
@(x) % Take x as input
@(x) strsplit(x) % split string at spaces and create a cell array
@(x) bin2dec(strsplit(x)) % Convert each row to integers
@(x) bin2dec(strsplit(x))' % Transpose into column vector
@(x)['',bin2dec(strsplit(x))'] % Concatenate with the empty string to cast to chars
Python 3, 53 bytes
lambda x:[print(end=chr(int(i,2)))for i in x.split()]
Used the int(i,2) to convert number from base 2 to 10. In-built functions for the win.
Zsh, 27 26 22 bytes
-1 from roblogic, -4 from a new strategy using an array and ${a/b/c} replacement.
printf %s ${(#)@/#/2#}
Try it online!
Try it online!
Try it online!
The (#) flag causes arithmetic expansion to be done to the contents of the parameter. Flags are parsed after the replacement. # matches the start of a string when at the start of a ${ / / } pattern. So each parameter is # prefixed with 2#, which Zsh recognizes as a base 2 number when (#) arithmetic expansion is done.
This relies on flexible I/O, each group of bits in its own parameter. This is what the pure bash answer does as well. To parse a single string, +4 bytes are needed: (Example)
printf %s ${(#)${=1}/#/2#}
Python 3, 48 44 bytes
[print(end=chr(int(i,2)))for i in s.split()]
previous answer,
[print(end=chr(eval('0b'+i)))for i in s.split()]
Learnt the print(end=...) trick in the "Scream the loudest" challenge. Pretty neat.
As far as I know, there is no direct conversion to ascii from binary string, so we have to suffer the '0b' in the eval.
Thanks to this python answer for giving int(i,2)
Excel Insider Beta v2203+, 41 Bytes
Worksheet function that takes input from range A1 and outputs to the calling cell.
Makes use of the TextSplit(...) function, one of many text and array functions added in Excel Insider Beta Version 2203.
=Concat(Char(Bin2Dec(TextSplit(A1," "))))
JavaScript, 64 bytes
s=>s.replace(/\d+./g,c=>eval(`'\\x${('0b'+c|0).toString(16)}'`))
Trying something different to this JS answer, not sure if it can be shorter.
TECO, 35 bytes
Z+1<0A"DQn*2#(0A-48)Un|QnI^[0Un'1:D>
^[ stands for esc.
Explanation
I1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100^[
! insert input string to the buffer !
J ! reset to zero point !
Z+1< ! loop over all chars !
0A"D ! if the current char is a digit !
Qn*2#(0A-48)Un ! append the bit to register n !
D ! remove current char !
| ! else !
QnI^[ ! insert value of register n as ASCII !
0Un ! clear n !
1:D ! delete one char without signaling error !
' ! end if !
> ! end loop !
HT ! type out result !
Vyxal s, 3 bytes
vBC
How?
vBC
vB # Vectorized convert to decimal
C # Convert character codes to list of characters
# S flag concatenates result
If we have to receive input separated by spaces, then:
Vyxal s, 4 bytes
⌈vBC
Python 3, 55 bytes
lambda s:"".join(map(lambda b:chr(int(b,2)),s.split()))
Or 46 bytes if we return an iterator instead of a string:
lambda s:map(lambda b:chr(int(b,2)),s.split())
Scala 2.12, 47 bytes
_ split " "map(_./:(0)(_*2+_-48)toChar)mkString
Splits on spaces, maps each string representing a binary number to an integer, turns into a Char, and then joins all those characters together. Scala 2.12 is required because of postfix operators.
Python 3, 43 bytes
for i in s.split():print(end=chr(int(i,2)))
fixed a blunder! Thanks to @caird-coinheringaahing XD
brainfuck, 74 61 bytes
,[>++++[>++++<-]>[<+<-->>-]<<[>[<->-]<<[>++<-]]<[.[-]]>>>,]<.
Explanation:
[tape: char, 'input, 16, 16]
[ else]
,[ for each input
>++++[>++++<-]> set const 16
[<+<-->>-] decrement input by 32
<<[ if not input = space
>[<->-] decrement input by 16
<<[>++<-] add double of char to input
]
<[ else
. print character
[-] delete character
]
>>>, input next character
]
<. print last character
Japt -P, 4 bytes
¸®Íd
¸®Íd :Implicit input of string
¸ :Split on spaces
® :Map
Í : Convert from binary string to integer
d : Get character at that codepoint
:Implicitly join & output
Python 3, 33 bytes
bytes(int(c,2)for c in s.split())
This solution outputs a byte string in Python. If it is required to return a regular Python string:
Python 3, 42 bytes
bytes(int(c,2)for c in s.split()).decode()
K (ngn/k), 15 11 bytes
Solution:
`c$2/10\. s
Explanation:
`c$2/10\. s / the solution
s / input s
. / value "1100" => 1100
10\ / convert to base 10
2/ / convert from base 2
`c$ / cast to character
- -4 bytes thanks to ngn!
C# (Visual C# Interactive Compiler), 61 bytes
s.Split(" ").Aggregate("",(a,b)=>a+(char)Convert.ToByte(b,2))
Splits the binary string, and adds each byte into the string. You need to have the seed for aggregate, or else the first byte won't be parsed.
K4, 18 bytes
Solution:
"c"$2/:'"1"=" "\:s
Example:
q)s:"1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100"
q)k)"c"$2/:'"1"=" "\:s
"Hello World"
Explanation:
"c"$2/:'"1"=" "\:s / the solution
s / the input
" "\: / split (\:) on " "
"1"= / equal to "1" ?
2/:' / join (/:) each (') from base-2
"c"$ / cast to characters
05AB1E (legacy), 4 bytes
#CçJ
Explanation:
#CçJ
# : Split implicit input at spaces
C : Convert every element to int
ç : chr(n)
J: Join elements, push it to the stack for printing
Edit: I noticed I perfectly duplicated a previous answer by my own, but keep it.
Bash (Pure): 54
Pure bash and no fork!
f(){ for a;do printf -vv \\%o $[2#$a];printf $v;done;}
f 1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100
Hello World
Explanation
f()declare function ffor a;do ... donetake each argument successively and attrib them to variableain loop$[2#$a]convert binary to decimalprintf -vv \\%o $...convert decimal to octal, preceded by backslash\for next printf and attribute this to variablev.printf $vwill render character.
Perl 6, 24 bytes
*.words>>.&{:2($_)}.chrs
Anonymous Whatever lambda that takes a string and returns a string.
Explanation
*.words # Split by spaces
>>.&{ } # Map each word to
:2($_) # Parsing it as binary
.chrs # Convert to characters
Powershell, 48 bytes
Inspired by Joey's and fuandon's answers.
-join(-split$s|%{[char][convert]::ToByte($_,2)})
Common Lisp, 79 bytes
(map'string'code-char(let((*read-base* 2))(read-from-string(format()"(~a)"s))))
Gol><>, 27 24 bytes
IWaSD$|rlF2LX*}|lR+oiE;~
Explanation:
I //Read the next number as integer
W //Loop to extract single digits
aSD // Perform a mod & div by 10 on the current number
$| // Repeat until the number is 0
r //Reverse the stack to go from LSB to MSB
lF //Loop over all single bits and replace all 1's with their corresponding value
2LX // Push 2^x where x is the number of the current bit -> value of topmost bit
* // Multiply the value of the topmost bit with the bit itself
}| // Shift right to get the next bit
lR+ //Add all values on the stack together
o //Output the decimal value as a char
iE;~ //Check for EOF if true terminate
Perl, 27 bytes
say pack"(B8)*",split' ',$s
Deorst, 11 bytes
o k`]mxmcE;
How it works
Example input: 1001000 1100101
o<space> - Push a space; STACK = [' ', '1001000 1100101']
k - Turn off sort; STACK = [' ', '1001000 1100101']
` - Split; STACK = [['1001000', '1100101']]
] - Flatten; STACK = ['1001000', '1100101']
mx - Map from binary; STACK = [72, 101]
mc - Map to character; STACK = ['H', 'e']
E; - Concatenate; STACK = ['H', 'e', 'He']
q/kdb+, 22 bytes
Solution:
10h$0b sv'"1"=-8$" "vs
Example:
q)10h$0b sv'"1"=-8$" "vs"1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100"
"Hello World"
Explanation:
Split string on " ", left-pad each to 8 characters, return boolean list where each string is equal to "1", convert each 8-bit list to a byte and then cast to a string:
10h$0b sv'"1"=-8$" "vs / the solution
" "vs / split (vs) on " "
-8$ / pad ($) to 8-long, negative means left-pad
"1"= / is item in each list equal to 1, returns true (1) or false (0) for each
0b sv' / convert each (') from boolean list to bytes
10h$ / cast ($) to character type (10h)
Python, 46 bytes
''.join(map(lambda x:chr(int(x,2)),s.split()))
AHK, 115 bytes
Loop,Parse,s," "
{x:=D(A_LoopField)
Send % Chr(x)
}
D(x){
Return (StrLen(x)>1?D(SubStr(x,1,-1))<<1:0)|SubStr(x,0)
}
The loop parses the string using a space as the delimeter.
The function D(x) converts x from binary to decimal.
The Chr function returns the ASCII character with the value x.
JavaScript (ES6) 49 55 56 64
s.replace(/\d+./g,x=>String.fromCharCode('0b'+x))
Edit Accepting @bebe suggestion - thanks
Edit2 Didn't know about binary numeric literal - thanks @kapep
Edit3 Wow 6 not 4 bytes saved thx @ETHproductions
Explanation as requested in comments
String.replace can take 2 arguments:
- regular expression
/\d+./g: one or more digits followed by one different character - the g flag specify to search the pattern more than once - a function, here specified in arrow format, where the argument (x) wil be the found string (the sequence of digits eventually followed by a space) and the value of the function is what is replaced (in this case, the single character from the code).
It's worth noting that the at the end of the string the regexp matches the sequence of digits without a trailing space, in this case the dot matches the last digit. Try '123'.match(/(\d+)./) to verify.
(Still) one of the more verbose pieces of javascript ever...
(Assignment to string s not counted)
var s='1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100'
var x=
s.replace(/\d+./g,x=>String.fromCharCode('0b'+x))
console.log(x)
GNU Sed, 19 bytes
Inspired by an excellent @Digital Trauma answer.
Golfed
s/\w*/dc -e2i&P;/eg
Test
echo 1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100|\
sed 's/\w*/dc -e2i&P;/eg'
Hello World
REXX, 56 bytes (or 15)
o=
do w=1 to words(s)
o=o||x2c(b2x(word(s,w)))
end
say o
Alternatively, if the input values are an even 8 bits instead of varying in length as in the example, this may be shortened to just one line:
say x2c(b2x(s))
Erlang, 45 Bytes
[binary_to_integer(X,2)||X<-re:split(S," ")].
Strings are represented as a list of integers in Erlang. This returns a list of ASCII codes which, when printed, will be represented as a string if all ASCII codes are printable characters.
Haskell -- 48 (+13 imports (?))
Here's my first golf attempt in Haskell.
map(chr.foldl1((+).(*2)).map digitToInt)$words s
You need to import Data.Char
usage (in ghci):
Prelude> :m +Data.Char
Prelude Data.Char> let s = "1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100"
Prelude Data.Char> map(chr.foldl1((+).(*2)).map digitToInt)$words s
"Hello World"
Explanation:
map(chr.foldl1((+).(*2)).map digitToInt)$words s
$words s -- split s on spaces into a list
map digitToInt -- convert each digit in input string to int
((+).(*2)) -- a function that multiplies its first
-- argument by 2, then adds the second argument
foldl1((+).(*2)).map digitToInt -- fold the above over the list of ints:
-- in other words this is a function that reads strings as binary and gives the value as int
(chr.foldl1((+).(*2)).map digitToInt) -- cast to character
map(chr.foldl1((+).(*2)).map digitToInt)$words s -- map our function over the list of words
Lua, 59 bytes
for k in s:gmatch'%d+'do io.write(s.char(tonumber(k,2)))end
CJam, 11 bytes
NS/{:~2bc}/
s isn't a legal variable name in CJam, so I chose N instead.
Example run
$ cjam <(echo '
> "1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100"
> :N;
> NS/{:~2bc}/
> '); echo
Hello World
How it works
NS/ " Split N at spaces. ";
{ }/ " For each chunk: ";
:~ " Evaluate each character ('0' ↦ 0, '1' ↦ 1). ";
2b " Convert from base 2 array to integer. ";
c " Cast to character. ";
QBasic, 103
s$=s$+" ":FOR i=1 TO LEN(s$):c$=MID$(s$,i,1):IF c$=" "THEN n=0:r$=r$+CHR$(n)ELSE n=n*2+VAL(c$)
NEXT:?r$
What? We have no fancy binary-to-decimal functions here. Do it yourself!
I'm counting the newline (which I think is necessary to get the if-then-else without an END IF) as one byte, per this meta post. I don't know whether QB64 on Windows would accept a code file that way or not. Probably doesn't much matter.
Clojure 63 (or 57)
The all-Clojure impl:
(apply str(map #(char(read-string(str"2r"%)))(re-seq #"\d+"s)))
With Java interop:
(apply str(map #(char(Long/parseLong % 2))(.split s" ")))
REPL session:
golf> (def s "1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100")
#'golf/s
golf> (apply str(map #(char(read-string(str"2r"%)))(re-seq #"\d+"s)))
"Hello World"
golf> (apply str(map #(char(Long/parseLong % 2))(.split s" ")))
"Hello World"
Bash+common linux utils, 25 bytes
dc<<<2i$s[Pz0\<m]dsmx|rev
dc explanation
- push 2 to the stack; pop and use as input radix
- push input string to stack (all values at once)
- Define recursive macro
mto:- pop, then print value as ASCII
- push stack depth to stack
- push 0 to stack
- pop top 2 stack values; compare and call
mmacro if stack non-empty
- duplicate top of stack (macro definition)
- pop and save macro to
mregister - pop and execute macro
Because we push the whole binary string to the stack first, when we pop each value, we end up with the string reversed. So we use the rev utility to correct that.
Example usage:
$ s="1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100"
$ dc<<<2i$s[Pz0\<m]dsmx|rev
Hello World
$
Bacchus, 25 bytes
S,' 'j:A=(Ö,2,10b:c),A¨
Explanation:
S,' 'j split the String S by the empty space and converts it to a block (some sort of array).
:A= get the previous Block and assing it to A variable.
(),A¨ for Each element in A
Ö,2,10b Read the current element (represent by Ö) in base 2 and transform it to base 10.
:c get the previous value and print as char
Java 8 : 60 bytes
Using lambdas in Java 8 (75 bytes):
Arrays.stream(s.split(" ")).reduce("",(a,b)->a+(char)Byte.parseByte(b,2));
And if you allow static imports (which some here used) it is (61 bytes):
stream(s.split(" ")).reduce("",(a,b)->a+(char)parseInt(b,2))
A tiny bit shorter version using for loop (60 bytes):
for(String n:s.split(" ")){out.print((char)parseInt(n,2));}
Groovy 64
{it.split(" ").collect{Integer.parseInt(it,2) as char}.join("")}
PHP (61)
<?=join(array_map('chr',array_map('bindec',explode(' ',$s))))
Ruby, 36 32
s.split.map{|x|x.to_i(2).chr}*""
Or 31
s.gsub(/\w+ ?/){$&.to_i(2).chr}
Optimizations thanks to Chron
JavaScript 111
This does the number conversion without parseInt or eval. Reading the string backwards and counting bits it set's bit x if it's a one. When a space is found a the number is converted to a char and a new 0 number is started for setting bits.
x=n=0,w='',s=' '+s
for(i=s.length;i--;){m=s[i]
if(m==1)n|=1<<x
x++
if(m==' ')w=String.fromCharCode(n)+w,n=x=0
}
APL (15)
⎕UCS{2⊥⍎¨⍕⍵}¨⍎s
Test:
s←'1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100'
⎕UCS{2⊥⍎¨⍕⍵}¨⍎s
Hello World
Explanation:
⍎s: evaluates, turning it into an array of integers. Arrays are written as numbers separated by spaces, so this splitss.{...}¨: for each element:⍕⍵: turn the number back into a string⍎¨: evaluate each individual digit, giving a bitstring2⊥: base-2 decode, giving the numbers
⎕UCS: get the character for each number
J (23)
u:;(#.@:("."0))&.>cut s
Test:
s=:'1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100'
u:;(#.@:("."0))&.>cut s
Hello World
Explanation:
cut s NB. split S on spaces
( )&.> NB. for each element
("."0) NB. evaluate each character
@: NB. and
#. NB. convert bitstring to number
; NB. unbox each number
u: NB. convert to ASCII
Run Length Encoded Brainfuck, 49 bytes
Since there are no variables in Brainfuck, I just used standard input and output instead.
The code 32+ should be interpreted as 32 +s by the interpreter. Just replace them manually if your interpreter doesn't support RLE.
>,[32->+<[16-<[>++<-]>[<+>-]>-<]>[<<.[-]>>-]<,]<.
Expanded (non-RLE) version: (91 bytes)
>,[-------------------------------->+<[----------------<[>++<-]>[<+>-]>-<]>[<<.[-]>>-]<,]<.
The code assumes that EOF is encoded as 0.
Explanation
The following layout is used:
+---+---+------+
| x | a | flag |
+---+---+------+
Where x is the ASCII byte to be printed, a is the a character from standard input and flag is 1 if a was a space.
>, Read a character a into the second cell
[ While not EOF:
32- Decrease a by 32 (a -= ' ')
>+< Set the flag to 1
[ If a was not a space:
16- Decrease by 16 more ('0' == 32+16)
<[>++<-] a += 2*x
>[<+>-] Move it back (x = a)
>-< Reset the flag, it was not a space.
]>
[ If a was a space (flag == 1):
<<.[-] Print and reset x
>>- Reset the flag
]
<, Read the next caracter a
]
<. Print the last character x
Powershell (52 49)
-join(-split$s|%{[char][convert]::ToInt16($_,2)})
Simple loop over binary string in $s. Having to include the [convert] kills my score though.
EDIT: There really is only one way of pulling this off in Powershell, wowie. Joey and I both got pretty much the same answer working independently!
Input:
1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100
Output:
Hello World
C - 57 43 38/31
38 Byte version:
for(int*x=s;putchar(strtol(x,&x,2)););
Or only 31 bytes if s is a pointer:
while(putchar(strtol(s,&s,2)));
I don't think this is exactly how for and while loop are supposed to be used... but it works.
C - 63
since C has no base 2 converter in standard library: test here
edit: there is, i'm just too stupid to know about it
r;f(char*s){for(;*s;(*s|32)-32||(putchar(r),r=0))r=2*r|*s++&1;}
x86 machine code on DOS - 22 bytes
00000000 30 d2 b4 08 cd 21 2c 30 72 06 d0 e2 08 c2 eb f2 |0....!,0r.......|
00000010 b4 02 cd 21 eb ea |...!..|
Since there are no real string variables in machine code (and in particular, no variables named "s") I settled for stdin as input.
NASM input:
org 100h
section .text
start:
xor dl,dl
loop:
mov ah,8
int 21h
sub al,'0'
jb print
shl dl,1
or dl,al
jmp loop
print:
mov ah,2
int 21h
jmp start
NodeJS – 62
Buffer(s.split(' ').map(function(a){return parseInt(a,2)}))+''
PHP – 75
array_reduce(explode(' ', $b),function($a,$b){return $a.chr(bindec($b));});
PowerShell, 49
-join(-split$s|%{[char][convert]::toint32($_,2)})
EDIT: Didn't see the other PowerShell answer. But there is essentially only one way of solving this.
Perl 33 32
Edit: Updated solution, 32.
say$s=~s/\d+ ?/chr oct"0b$&"/rge
Previous solution (33):
$_=$s;say map{chr oct"0b$_"}split
or
say map{chr oct"0b$_"}split/ /,$s
Test:
perl -E '$s="1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100";$_=$s;say map{chr oct"0b$_"}split'
Pyth, 12
smCv+"0b"dPZ
Note that s is not a legal variable in Pyth, so I used Z instead.
Explanation:
print(
s sum(
m map(lambda d:
C chr(
v eval(
+"0b"d "0b"+d)),
P split(
Z Z))))
Example:
=Z"<the binary string from above>"smCv+"0b"dPZ
Hello World
Mathematica, 52 bytes
Ah, Mathematica's lovely function names
f=FromCharacterCode[#~FromDigits~2&/@StringSplit@#]&