g | x | w | all
Bytes Lang Time Link
059Tcl250227T162841Zsergiol
006Coreutils sum240620T060141Zroblogic
003Japt240619T223222ZShaggy
017><>240619T133238ZEvylah
054Google Sheets240613T214222ZGlory2Uk
000Thunno 2 SB230608T183713ZThe Thon
nanFig221011T195812ZnaffetS
010Raku221011T195522ZSean
058Go221011T155413Zbigyihsu
002K ngn/k221011T093734Zoeuf
003Pyth221011T072556Zu-ndefin
002Vyxal221011T064929ZDialFros
513𝔼𝕊𝕄𝕚𝕟 2160106T010804ZMama Fun
002PlatyPar160106T003339ZCyoce
079Java 8160102T144832ZThe Code
002Jolf160104T013524ZConor O&
077JavaScript function golf160106T113514Zuser4853
004Gol><>160102T160246Zrandomra
006Japt160104T030623ZETHprodu
002W191130T103247Zuser8505
002Keg190902T125313Zuser8505
035Wren191130T113126Zuser8505
065Unexpended Sinclair ZX80 65 tokenized BASIC bytes190619T150440ZShaun Be
6577BrainFlak190902T131439ZDorian
004@190902T124540Zuser8505
nanRunic Enchantments190619T231946ZDraco18s
046PHP190620T150413Z640KB
001Japt mx190620T134545ZOliver
022Kotlin190619T175159Zsnail_
005Ahead190619T174222Zsnail_
014C# Visual C# Interactive Compiler190619T100701ZInnat3
061Whitespace190619T064248ZKevin Cr
00205AB1E190619T063036ZKevin Cr
015Perl 5 pF190619T053506ZXcali
012Ruby140605T142855ZDoorknob
4236SML140607T005620Zsomeonr
006Minkolang161224T104921Zuser4180
015Brainfuck 15 Bytes161224T104911ZFinW
002Pushy161224T104812ZFlipTack
024Python161224T104558ZFlipTack
010Cubix161224T102811ZETHprodu
037JavaScript ES6161224T100501ZETHprodu
018Hoon160523T160038ZRenderSe
031Clojure160523T152926Zcliffroo
037Python 3160521T151741Zm654
008Unipants' Golfing Language160420T160047Zuser4853
013Mathcad160422T085859ZStuart B
113Java 8160421T223511ZKhaled.K
003Factor160422T023228Zcat
139Java160421T223957ZAshwin G
131C++160421T205949ZMichelfr
011Mathcad160420T161443ZStuart B
012jq151007T162425Zmanatwor
041Javascript ES6151009T030247ZMama Fun
3260CJam140606T165149Zaditsu q
019Mathematica160104T021754Znjpipeor
nanJava160102T134705ZSuperJed
059Go140606T060915Zvoutasau
nanPerl151007T190217Zsteve
001gs2151007T192154Zlynn
022Perl151007T191942ZF. Hauri
004Matlab/Octave151007T172129Zflawr
019><>151007T171356ZDanTheMa
035Common Lisp151007T151439Zcoredump
002K5151007T141131Zkirbyfan
nanR140606T143444Zplannapu
0418086 Assembly 16bit140618T233328Zanatolyg
006Befunge98140605T212210Zalephrei
007J140605T150231Zɐɔıʇǝɥʇu
008k140607T161628Zskeevey
051Javascript ES6140607T062012Znderscor
nanJulia 11 7 characters140606T043058ZGlen O
029Shell+GNU tools140605T175302ZDigital
027PowerShell140606T152041ZRynant
083Delphi140606T145350ZTeun Pro
009J140606T142242ZDan Bron
nan140605T164531Zcore1024
028C# in LINQPad140605T193132ZJacob
081Cobra140606T041013ZΟurous
033Perl140605T214402ZSL2
063C140605T204329ZAbhijit
060D function140605T175326ZHugo Dub
036Haskell140605T144505Zgxtaillo
032C140605T174224Zbebe
004GolfScript140605T143137ZDoorknob
028Python 3140605T143145Zundergro
057Lua140605T143643ZKyle Kan
008APL140605T142846Zmarinus

Tcl, 59 bytes

proc s s {expr [lmap c [split $s ""] {list +[scan $c %c]}]}

Try it online!

Coreutils sum, 8 6 bytes

Gnu Coreutils sum, (obsolescent but remains available for compatibility) takes an input stream or a file. The -s flag invokes old System V logic, which just adds up the byte values.

sum -s

Try it online! 8 bytes
Notes:
* sum defaults to the BSD checksum algorithm which is also obsolescent
* Bonus score: 533⭐️
* related q:258739

Japt, 3 bytes

¬xc

Try it

Or, if we can take input as a character array ...

Japt -mx, 1 byte

c

Try it

><>, 17 bytes

0i:0(?v+!
   ;n~<

basically my first answer I thought of, I couldn't think of ways to optimize this further.

Google Sheets, 59 54 bytes

=SUM(ARRAYFORMULA(code(mid(A1,SEQUENCE(len(A1)),1))))

A cell formula based on the array reduction: the character codes are accumulated and the end sum is output

Below is the old 59 byte version:

=REDUCE(,SEQUENCE(LEN(A1)),LAMBDA(a,b,a+CODE(MID(A1,b,1))))

.

Thunno 2 SB, 0 bytes

Attempt This Online!

Or, 2 bytes flagless:

CS

Attempt This Online!

Fig, \$1\log_{256}(96)\approx\$ 0.823 bytes

S

Try it online!

Raku, 10 bytes

*.ords.sum

Try it online!

The ords string method conveniently returns a list of the ordinal values of the characters.

Go, 58 bytes

func f(b[]byte)(s int){for _,e:=range b{s+=int(e)}
return}

Attempt This Online!

K (ngn/k), 2 bytes

+/

Try it online!

In K, a string is basically a list of ASCII char codes, so just the sum adverb will do the job.

Pyth, 3 bytes

sCM

Try it online!

Alternatively, smC works as well.

Explanation:

    # implicit output
s   # sum(                )
  M #     map(   ,       )
 C  #         ord
    #             input()   -> implicit input

Vyxal, 2 bytes

C∑

Try it Online!

Explained

C∑
C  # char
 ∑ # sum

𝔼𝕊𝕄𝕚𝕟 2, 5 chars / 13 bytes

⨭ ᴉ⒨⒞

Try it here (Firefox only).

Splits and maps the input to its charcodes, then sums the resulting array.

PlatyPar, 2 bytes

us

Try it online!

u generates an array of all charcode values in the input string, and s finds their sum.

When run on itself, it returns 232.

This is similar to Conor's Jolf answer, except that I use a byte to convert the string into an array of character codes (which is implicit in Jolf), whereas he uses a byte to retrieve the input (which is implicit in PlatyPar).

Java 8 - 79 bytes

interface C{static void main(String[]a){System.out.print(a[0].chars().sum());}}

Jolf, 2 bytes

Try it here!

ui
u  sum of
 i  the input string

Umm... I don't know what else to say.

JavaScript function golf, 77 bytes

var s=i();var x=0;for(var i1=0;i1<sl(s);i1++){x+=schca(s,i1);}console.log(x);

I made this for you!

Yes, you got it right, it's my own function golf again. It recently got a string functions update.

The language was created after the challenge, so it's non-competing.

Validity source:

>>> var s=i();var x=0;for(var i1=0;i1<sl(s);i1++){x+=schca(s,i1);}console.log(x);
Hello World!
1085

Bonus score:

>>> var s=i();var x=0;for(var i1=0;i1<sl(s);i1++){x+=schca(s,i1);}console.log(x);
var s=i();var x=0;for(var i1=0;i1<sl(s);i1++){x+=schca(s,i1);}console.log(x);
6276

Gol><>, 4 bytes

iEh+

Japt, 6 bytes

U¬mc x

Pretty simple. Try it online!

How it works

U¬mc x  // Implicit: U = input string
U¬      // Split U into chars.
  mc    // Map each item to its char code.
     x  // Sum.
        // Implicit: output last expression

W, 2 bytes

The Join function also works with numbers.

CJ

W, 4 bytes

Terribly golfed answer...

C@+R

Keg, 2 bytes

?⅀

Try it online!

Explanation

?  # Read the full input string
 ⅀ # Sum the whole stack
# Implicit output

Wren, 35 bytes

The fact that they aren't doing this in Wren is a perfect chance for me.

Fn.new{|x|x.bytes.reduce{|a,i|a+i}}

Try it online!

Explanation

Fn.new{|x|                        } // New anonymous function with parameter x
          x.bytes                   // Convert x to its bytecode forms
                 .reduce{|a,i|a+i}  // Sum this bytecode form

Unexpended Sinclair ZX80 - 65 tokenized BASIC bytes

 1 INPUT A$
 2 LET A=0
 3 IF A$="" THEN GO TO 7
 4 LET A=A+CODE(A$)
 5 LET A$=TL$(A$)
 6 GO TO 3
 7 PRINT A

There are a few caveats, without POKEing some (or one, I don't recall) memory location(s), all maths is done via 16-bit signed integers, so the range is -32768 to +32767, so any string entered that is too long will overflow the VAR stack and break the program. Also, the ZX80 character set is not ASCII compatible and there is no exclamation mark, so HELLO WORLD (as there are no lower-case characters by default either) is 494 - source.

BASIC does not update the screen whilst doing calculations and such, so after entering the string it will take some time to work out where nothing will be displayed. Your original string entered in the A$ variable will not show.

Sinclair ZX80 Calculator that adds char values

Brain-Flak, 6 bytes (own code sum: 577)

({{}})

Try it online!

Seems to be a good challenge for Brain-Flak.

Explanation:

 {  }   while top of Stack is not 0, calculate sum of
  {}    pop value
(    )  push calculated sum
        implicitly output the Stack

@, 4 bytes

Seems like a perfect task for @.

Σš

Explanation

Σ  Summation of
 š a one-line input

Runic Enchantments, 10 bytes (Self-sum: 703)

iul1)?@+2?

Try it online!

It has a limit on how long of a string it can handle. For a version that can handle any length string:

/l͍:i0< /~~@
R1-:0≮?/:}}:{%3s}+}

Try it online! (Self-sum: 3937)

In both cases spaces need to be escaped in order to be read as a single input. The first one works by unconcatening the string and iteratively adding each character together until only a single value is left (printing it).

The second uses an index pointer and extracts one character at a time, adding it to a running total (requiring more in the way of setup and stack manipulation).

PHP, 46 bytes

No PHP answer on this yet, so here's the easy one:

<?=array_sum(array_map(ord,str_split($argn)));

Try it online!

$ echo Hello World!|php -F addascii.php
1085

More non-competing answers:

48 bytes

Iterative:

foreach(str_split($argn)as$s)$x+=ord($s);echo$x;

Try it online!

51 bytes

Iterative 2:

while($i<strlen($argn))$x+=ord($argn[$i++]);echo$x;

Try it online!

63 bytes

Recursive:

function f($s,$c=0){return$s?f(substr($s,1),ord($s[0])+$c):$c;}

Try it online!

69 bytes

Using PHP's rarely used [citation needed] array_reduce() function:

<?=array_reduce(str_split($argn),function($c,$i){return$c+ord($i);});

Try it online!

Japt -mx, 1 byte

c

Try it!


If the input cannot be an array of chars, then this can be done in 3 bytes:

¬xc

Try it!

Kotlin, 22 bytes

(String) -> Int lambda.

{it.sumBy{it.toInt()}}

Try it online!

Ahead, 5 bytes

SK+O@

S      slurp input
 K+    reduce stack by summing
   O   output sum
    @  end

Try it online!

C# (Visual C# Interactive Compiler), 14 bytes

s=>s.Sum(x=>x)

Try it online!

Whitespace, 61 bytes

[S S S N
_Push_0][N
S S N
_Create_Label_LOOP][S N
S _Duplicate_top][S N
S _Duplicate_top][T N
T   S _Read_STDIN_as_character][T   T   T   _Retrieve_input][S N
S _Duplicate][S S S T   S T S N
_Push_10][T S S T   _Subtract][N
T   S S N
_If_0_Jump_to_Label_PRINT][T    S S S _Add][N
S N
N
_Jump_to_Label_LOOP][N
S S S N
_Create_Label_PRINT][S N
N
_Discard_newline][T N
S T _Output_top_as_integer]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Since Whitespace inputs one character at a time, the input should contain a trailing newline so it knows when to stop reading characters and the input is done.

Try it online (with raw spaces, tabs, and new-lines only).

Explanation in pseudo-code:

Integer s = 0
Start LOOP:
  Integer c = Read STDIN as character
  If(c == 10) // c == '\n'
    Call function PRINT
  s = s + c
  Go to next iteration of LOOP

function PRINT:
  Discard the top of the stack (the 10 / newline)
  Print s as integer to STDOUT
  

05AB1E, 2 bytes

ÇO

Try it online.

Explanation:

Ç   # Convert each character in the (implicit) input to its unicode value
 O  # Sum this list of integers
    # (after which the result is output implicitly)

Perl 5 -pF, 15 bytes

Under the rules in place at the time of this challenge, I believe it would have been +3 for the command line flags, giving a score of 18.

map$\+=ord,@F}{

Try it online!

Ruby, 13 12 bytes

p~9+gets.sum

sum is a built-in function that sums the characters of a string. Subtracts 10 to account for the newline at the end of gets's return value.

(Edited 4 years later to change x-10 to ~9+x... the value of ~9 is -10, but it lets us remove the space between p and its argument, saving a byte.)

SML, 42 36

Just adding another language.

fun$x=foldl op+0(map ord(explode x))

Converts String to char array, calculates ascii number of each value and calculates the sum of all ascii numbers.

Minkolang, 6 bytes

$o$+N.

Try it online!

Explanation

$o         takes all characters from input as chars (the characters are automatically
           converted to their character codes)
$+         sum up all the values
N.         output as number and end program

Brainfuck - 15 Bytes

,[>,]<[[<+>-]<]

Try it here (You have to click the box marked "!")

Put your input after the exclamation point. (not necessary but allows easy EOF.)

What it does

,[>,]     take input as characters in separate cells until input has ended (automatically in ascii)
<         go to the last character
[         infinite loop
[<+>-]    add the last character and the character before it and save it as the last character
<]        go back to the last character and then do the infinite loop again

Unfortunately, it exits with an out of memory error and does not print the output, but that wasn't part of the challenge. If you want to see the output, read the tape. It also only goes up to 255 on this interpreter. (if anyone knows an interpreter with larger cells that exits on error, that would be great)

Pushy, 2 bytes

S#

Try it online!

Input is automatically converted to charcodes and placed on the stack. S sums the stack, and # prints it.

Python, 24 bytes

This is shorter than any Python solution so far: an unnamed anonymous function, which takes the string as an argument, and returns the sum.

lambda x:sum(x.encode())

Try it online!

First, x.encode() transforms it into a bytes object. Then, sum adds the char-code values. As this is a lambda function, the value is implicity returned.

Additionally, one could have lambda x:sum(map(ord,x)) for the same byte count.

Cubix, 10 bytes

OU@;i)!^(+

Test it online!

This is almost the perfect challenge for Cubix, which can only input one char code at a time. This code expands to the following cube net:

    O U
    @ ;
i ) ! ^ ( + . .
. . . . . . . .
    . .
    . .

The code is then run, starting at the i and facing east. Here's the main loop:

When EOF is reached, the ! fails, and ^ forces the instruction pointer to move north onto the top face. Then this code is run:

JavaScript (ES6), 37 bytes

f=([c,...a])=>c?c.charCodeAt()+f(a):0

This uses a handy feature, new in ES6: destructuring assignments. When run, the variable c gets set to the first char in the string, and a gets set to the rest of the string as an array.

Hoon, 18 bytes

|*
*
(roll +< add)

This is a wet gate, so that I don't have to specify tape instead of *. This has the added bonus of it being fully generic, so it could actually accept (list @ud) too. Wet gates typecheck at the call site, instead of definition.

+< is the sample of the gate, indexed into the sample with tree navigation syntax because it's shorter than naming the function arguments. |*(a/* a) is longer than |*(* +<).

> %.  "Hello World!"
  |*
  *
  (roll +< add)
b=1.085

Unfortunately, this doesn't work correctly as-is with unicode. Urbit's string literals are lists of UTF8 chars. You can use ++tuba to convert it to UTF32, though.

> %.  "⚳ℚ⊻"
  |*
  *
  (roll +< add)
b=1.622

> %.  (tuba "⚳ℚ⊻")
  |*
  *
  (roll +< add)
b=27.272

Clojure, 31 bytes

#(reduce +(map int(read-line)))

Really straightforward. Gets its input from stdin, works with Unicode.

Python 3, 37 bytes

print(sum([ord(c) for c in input()]))

There's a shorter one, but this is possible as well. It converts the string into a list will all the ASCII values of the characters and adds them together using sum().

Star version, 55 bytes

a=sum([ord(c) for c in input()]);print(a);print(chr(a))

Now gimme my gold star.

Unipants' Golfing Language, 8 bytes

cIl+I:_o

Try it online!

Returns 660 given its own source code.

Explanation

cIl+I:_o
c        # Create an integer. We need it - you'll see why.
 I       # Input the first character.
  l  :   # While loop.
   +     # Add the character value to the integer. This is
         # why we needed an integer. Otherwise, there would
         # only be 1 item in a stack now, and the "+" op is
         # not defined for this case. In fact, it returns 0
    I    # Input the next character.
      _  # Discard a zero (the zero from the last input,
         # representing the End Of Line).
       o # Output the result.

Mathcad, 13 "bytes"

enter image description here

Uses built-in vector summation operator and string-to-vectorOfCharacterCodes function. Definition operator ":=" entered by single key ":", summation operator by ctl-4.

Java 8, 113 chars

BigInteger C(String s){BigInteger i=BigInteger.ZERO;s.chars().forEach(x->i=i.add(BigInteger.valueOf());return i;}

Note each character in Java is Unicode 1-4 bytes unsigned integer, using sum function would easily overflow.

Detailed

BigInteger C (String s)
{
    BigInteger i = BigInteger.ZERO;

    s.chars().forEach(x -> i = i.add(BigInteger.valueOf(x));

    return i;
}

Java 8, 57 chars

ASCII only solution

int C(String s){return s.chars().filter(x->x<128).sum();} 

Detailed try here

public static int C (String s)
{
    return s
        .chars() // stream the characters
        .filter(x -> x < 128) // filter ASCII (optional)
        .sum(); // return the sum
}

Factor, 3 bytes

sum

Strings are sequences, arrays of char values. sum is basically 0 [ + ] reduce (or, equivalently, [ + ] foldl), so this sums the chars in a string.

Java, 139 Bytes

//takes input from cmd line args

class P {public static void main(String a[]){String s=a[0];int v=0;for(int i=0;i<s.length();i++){v+=(int)s.charAt(i);}System.out.print(v);}}

It's big, but yeah.

C++, 131 140 bytes

Golfed:

#include<iostream>
int main(){int a=0;std::string x;getline(std::cin,x);for(int c=0;c<x.length();c++){a=a+(int)x[c];}std::cout<<a;}

Ungolfed:

#include<iostream>

int main(){
    int a = 0;
    std::string x;
    getline(std::cin, x);
    for(int c = 0; c < x.length(); c++){
        a = a + (int) x[c];
    }
    std::cout<<a;
}

Mathcad, 11 "bytes"

enter image description here

Uses Mathcad's built-in vector summation operator. As "whatever" is an input method, the user types the word directly into the argument for the function str2vec (which converts a string to a vector of its character codes).

jq, 12 characters

(11 characters code + 1 character command line option.)

explode|add

Sample run:

bash-4.3$ bin/jq -R 'explode|add' <<< 'Hello World!'
1085

On-line test (Passing -R through URL is not supported – so input passed as string "Hello World!".)

(CW because explode appeared in jq 1.4, released 4 days after this question.)

Javascript ES6, 41 bytes

_=>[..._].map(y=>x+=y.charCodeAt(),x=0)|x

Thanks to @ETHproductions for 2 bytes saved!

CJam, 3 bytes (sum 260)

q1b

You can try it online.
Thanks jimmy23013 for helping chop off 2 characters :)

Explanation:

q     read the input into a string  
1b    convert from base 1, treating each character as its numeric value

Mathematica, 19 bytes

Tr@*ToCharacterCode

Test case:

Tr@*ToCharacterCode@"Hello World!"
(* 1085 *)

Java, 144 bytes (sum of 13067)

interface S{static void main(String[]A){int I=0;for(char J:new java.util.Scanner(System.in).nextLine().toCharArray())I+=J;System.out.print(I);}}

Go (59 characters)

func d(s string)(t int){for _,x:=range s{t+=int(x)};return}

Everything in Go is utf8 by default. Codetext in ` delimeters run through itself gives an output of: 5399.

Perl, 34 32 27 25 21+1=22 bytes

Added 2 due to the need for -p flags. Thanks to @manatwork for the guidance.

$a+=ord for/./g;$_=$a

Test:

echo 'Hello World!' | perl -pe '$a+=ord for/./g;$_=$a'
1085

gs2, 1 byte

d

d (0x64 / sum), of course, sums up all bytes in standard input.

Perl 22

s/./$t+=ord$&/eg;say$t

sample:

perl -nE 's/./$t+=ord$&/eg;say$t'  < <(echo -n Hello\ World\!)
1085

Matlab/Octave 4 bytes (bonus: 405)

This code is an anonymous function, that does the job, it will take a string, and return the required number.

@sum

><>, 19 bytes

0i:1+?!v+!
    ;n~<

It does work on Unicode. For example, this correctly outputs 27272 : ⚳ℚ⊻

Try it here

Common Lisp, 35

(reduce'+(read-line):key'char-code)

Produces 3053 when given its own code.

K5, 2 bytes (function), 5 bytes (program)

Function

+/

Program

+/0:`

Not sure if K5 was created before or after this challenge was posted. Regardless...THIS IS AWESOME!!

In K5, if you perform arithmetic operations on strings, it converts the characters to their ASCII codes. So this just uses the sum operator +/ (actually, it's plus + over).

R, 35 characters (sum of 3086) 26 bytes (sum of 2305)

sum(utf8ToInt(readline()))

readline() is one character longer than scan(,"") but scan split the input on spaces by default.

Usage:

> sum(utf8ToInt(readline()))
Hello World!
[1] 1085
> sum(utf8ToInt(readline()))
sum(utf8ToInt(readline()))
[1] 2305
> sum(utf8ToInt(readline()))
q/%8hnp>T%y?'wNb\},9krW &D9']K$n;l.3O+tE*$*._B^s!@k\&Cl:EO1zo8sVxEvBxCock_I+2o6 yeX*0Xq:tS^f)!!7=!tk9K<6#/E`ks(D'$z$\6Ac+MT&[s[]_Y(`<g%"w%cW'`c&q)D$0#C$QGf>?A$iawvc,}`9!('`c&q)D$0#C$QGf>?A$iawvc,}`9!(
[1] 14835

8086 Assembly (16-bit) - 47 41 bytes

The contents of the test.com file are:

98 01 c3 b4 01 cd 21 3c 0d 75 f5 89 c7 c6 05 24
89 d8 b1 0a 4f 31 d2 f7 f1 80 ca 30 88 15 09 c0
75 f2 89 fa b4 09 cd 21 c3

Actual work is done in the first 11 bytes; I need the rest to print the result in decimal notation.

Source code (give as input to the DOS debug.com assembler):

a
; input the string; count the sum
    cbw
    add bx, ax
    mov ah, 1
    int 21
    cmp al, d
    jne 100
; Prepare for output: stuff an end-of-line marker
    mov di, ax
    mov [di], byte 24
    mov ax, bx
    mov cl, a
; 114
; Divide by 10; write digits to buffer
    dec di
    xor dx, dx
    div cx
    or  dl, 30
    mov [di], dl
    or  ax, ax
    jne 114
; Print the string
    mov dx, di
    mov ah, 9
    int 21
    ret

rcx 29
n test.com
w
q

Some notes on the code:

Befunge98, 6 bytes, sum: 445

2j@.~+

Any interpreter should be fine. I use CCBI.

Use as follows:

printf 'Hello World!' | ccbi calc.fg

Works for multibyte chars and empty strings.

Explanation

J (7)

So close, yet so far... Oh well, I guess 7 is decent enough, since this answer also accepts empty strings. (I'm basing my usage of a variable as input on the phrase from a file, stdin or whatever)

+/a.i.b

Explanation:

a.

┌┬┐├┼┤└┴┘│─ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~��������������������������������������������������������������������������������������������������������������������������������

a. contains all ASCII chars.

   'people' i. 'pow'
0 2 6

x i. y is similar to python's [x.index(i) for i in y].

   a. i. 'Hello World!'
72 101 108 108 111 32 87 111 114 108 100 33

Therefor, a. i. y converts y to an array of its ASCII values

   +/1 2 3 4 5 6
21

+/ is like sum: +/1 2 3 4 5 6 means 1+2+3+4+5+6

   +/ a. i. 'Hello World!'
1085

The whole thing in action

For the bonus:

   b=:'+/a.i.b'
   +/a.i.b
482

Not bad, I guess.

   b=:'0\{+}/'
   +/a.i.b
478

Well, darn.

   A=:'+/a.i.A'
   +/a.i.A
449

Thanks @algorithmshark

    A=:'+/3 u:A'
    +/3 u:A
413

Thanks @marinus

k (8 chars)

+/6h$0:0

Q translation

sum `int$read0 0

Bonus value:

k)+/6h$0:0
+/6h$0:0
438i

Javascript (ES6) 51

alert([...prompt(x=0)].map(y=>x+=y.charCodeAt())|x)

Julia - 11 7 characters, resultant sum = 943 536

Since the question allows the input to come from whatever source you want, I choose an existing variable. Assume that A contains the string we wish to evaluate.

sum(A)1

As it turns out, you can sum the string directly, and it will evaluate... however, due to the way that summing of chars is handled, if there is an odd number of characters in the string, it will output a character, rather than an integer of any sort. As such, we force it to cast to int by multiplying by 1.

Old version:

sum(A.data)

Will output in a hexadecimal notation (if the sum is less than 256, it'll be 0x??, otherwise it'll be 8 byte as 0x????????). If used in code where the result is used, it will operate just like any other number (it's just how Julia displays unsigned ints).

To see the value of the result in decimal, enclose the above in int(), as in int(sum(A.data)).

For anybody who doesn't know Julia, you assign to A exactly the same way you do other assignments to variables. So, A="Hello World!" or A="sum(n.data)". In the case where you need to put in " or ' characters, there are multiple options, the easiest of which (because it avoids need for knowledge of the nuances of Julia string literals) is A=readline(), followed by simply typing in the string into STDIN (won't handle newlines, though). The escape sequence for newline is, as usual, \n, but I don't believe you can use that with readline().

Shell+GNU tools, 29 bytes

echo `od -An -tuC`|tr \  +|bc

Takes input from stdin:

$ printf "%s" 'Hello World!' | ./addchars.sh 
1085
$ 

Own score: 2385


c, 52 bytes

c;main(p){while(~(p=getchar()))c+=p;printf("%d",c);}

Compile with (some warnings produced):

gcc addchars.c -o addchars

Takes input from stdin:

$ printf "%s" 'Hello World!' | ./addchars 
1085 $ 

Own score: 4354

PowerShell - 27

[char[]]$args[0]|measure -s

Example

> SumChars.ps1 'Hello World!'

Count    : 12
Average  : 
Sum      : 1085
Maximum  : 
Minimum  : 
Property : 

Delphi (87 83)

function x(s:string):int64;var c:char;begin x:=0;for c in s do x:=result+ord(c)end;

Ungolfed

function x(s:string):int64;
var
  c:char;
begin
  x:=0;
  for c in s do
    x:=result+ord(c)
end;

Loops through S adding the ord value of the char to the result. where x==result

Edits:

Saved 4 characters by switching to int64 and changing the adding to the sum.

J (9 chars)

In the REPL, we only need 6 chars:

   +/a.i.'Hello World!'
1085

To make it a re-usable program, we need to add 3 chars of decoration:

   as=: [: +/ a.&i.
   as 'Hello World!'
1085

JavaScript (ES6) 54 58

alert([].reduce.call(prompt(),(v,c)=>v+c.charCodeAt(0),0))

54 bytes thanks to nderscore:

alert([...prompt()].reduce((v,c)=>v+c.charCodeAt(),0))

C# in LINQPad, 28

Console.ReadLine().Sum(i=>i)

Cobra - 81

class P
    def main
        c,d=Console.readLine,0
        for i in c,d+=i to int
        print d

Perl 33

$_=<>;$x+=ord for split'';print$x

I don't know Perl too well. I'm sure it can be golfed some more.

C 63

main(a,b)char**b;{a+=*b[1];*b[1]++?main(a,b):printf("%d",a-2);}

D (function: 60)

Definitely not in it to win it.

Assuming it doesn't need to be a complete program

int c(string i){int s;foreach(e;i){s+=cast(int)e;}return s;}

Called like so

void main ()
{
    import std.stdio;
    auto hw = "Hello World!";
    writefln("%s = %d", hw, c(hw));
}

Output:

Hello World! = 1085

D (program: 133)

Does not count line breaks.

void main(){import std.algorithm,std.stdio;stdin.byLine.map!((a){int s;foreach(e;a){s+=cast(int)e;}return s;}).reduce!"a+b".writeln;}

With more whitespace and longer variable names for readability

void main () {
    import std.algorithm, std.stdio;

    stdin.byLine
        .map!((line) {
                int sum;
                foreach (ch; line) {
                    sum += cast(int)ch;
                }
                return sum;
            })
        .reduce!"a+b"
        .writeln;
}

To support line breaks in the input, I could either use byLine(KeepTerminator.yes) — the correct way, for 20 characters — or append a '\n' to my line — which breaks single-line input and may give the wrong sum on Windows because of CRLF, for 18 characters.

Haskell 36

main=interact$show.sum.map fromEnum

C 32

f(char*s){return*s?*s+f(s+1):0;}

GolfScript, 4 characters

{+}*

Simply uses the fold operator (*) to add up all the characters.

If it has to work with the empty string, 9 chars:

{{+}*}0if

Thanks to @PeterTaylor for providing an alternative 6-char version that works with empty string:

0\{+}/

Python 3 - 28 bytes

print(sum(map(ord,input())))

Example run:

$ ./sum_string.py <<< 'Hello World!'
1085

Gets input from stdin, maps the ord function to it to get the ASCII value of each character, sums it and prints.

Lua 57

a=io.read();b=0;for i=1,#a do b=b+a.byte(a,i)end print(b)

Sucks that it's the longest by a long shot, but whatever.

APL (8)

+/⎕UCS⍞

Explanation: