g | x | w | all
Bytes Lang Time Link
061AWK250930T171408Zxrs
043MATL170301T024249ZSuever
029Vyxal220412T041116ZnaffetS
052Factor220412T021533Zchunes
055JavaScript V8220411T211319ZMatthew
076Python 2.7170301T013041ZJonathan
031Jelly170301T010158ZJonathan
036Japt170301T045117ZOliver
141Java 8170301T095933Zanacron
145Swift170301T183555ZMr. Xcod
071Haskell170302T041948ZJules
054dc170301T215519ZJames Wa
059JavaScript170301T153158ZOliver
118Rebol170301T200232Zdraegtun
082Powershell170301T190834ZTor
069Python 2170301T102541Ziwaseate
087Python 2170301T135605ZDaniel
061PostgreSQL170301T135501Zkennytm
095Perl 6170301T143903ZHåv
108Clojure170301T155313ZNikoNyrh
068R170301T151623ZJoe
nanPython 3 86 bytes170301T002259Zboot-sco
080JavaScript ES6170301T010820ZNeil
03205AB1E170301T104836ZEmigna
125C#170301T092852Zadrianmp
086Mathematica170301T062946ZNot a tr
066K170301T023455ZChromozo
072Vim170301T021752Znmjcman1
074PHP170301T013444ZTitus

AWK, 61 bytes

$0=$1" is in the "int(log($2>0?$2:1)/log(10)/3)"-comma club."

Attempt This Online!

MATL, 50 48 43 bytes

`j' is in the 'i|kVn3/XkqV'-comma club'&hDT

Try it at MATL Online

Explanation

`                   % Do...While loop
  j                 % Explicitly grab the next input as a string
  ' is in the the ' % Push this string literal to the stack
  i                 % Grab the next input as a number
  |                 % Compute the absolute value
  k                 % Round towards zero
  V                 % Convert to a string
  n3/Xk             % Divide the length of the string by 3 and round up
  q                 % Subtract one
  V                 % Convert to a string
  '-comma club'     % Push this string literal to the stack
  &h                % Horizontally concatenate the entire stack
  D                 % Display the resulting string
  T                 % Push TRUE to the stack, causing an infinite loop which automatically
                    % terminates when we run out of inputs
                    % Implicit end of do...while loop

Vyxal, 29 bytes

¹ð«E⟨b?6Ḃ«⁰²∆τ6ḭS‹`ḊṄa ⟇¦.`Wṅ

Try it Online!

Explained

¹ð«E⟨b?6Ḃ«⁰²∆τ6ḭS‹`ḊṄa ⟇¦.`Wṅ
¹ð                             # Get first input and push space
  «E⟨b?6Ḃ«                     # Push compressed string "is in the "
          ⁰²                   # Get second input and square it
            ∆τ                 # Log10 it
              6ḭ               # Floor divide by 6
                S              # Stringify
                 ‹             # Push a hyphen
                  `ḊṄa ⟇¦.`    # Push string "comma club"
                           Wṅ  # Join stack

Factor, 52 bytes

[ sq log10 6 /i [I ${} is in the ${}-comma club.I] ]

Attempt This Online!

Port of @MatthewJensen's JavaScript answer.

JavaScript (V8), 55 bytes

n=>m=>n+` is in the ${Math.log10(m*m)/6|0}-comma club.`

Try it online!

Python 2.7, 89 86 84 76 bytes

for g,b in input():print g,'is in the',`~-len('%d'%abs(b))/3`+'-comma club.'

Try it online!

Full program that takes a list of pairs of names and bank balances - and prints the resulting strings. (Note the question states "friends array and amounts array, but this is the format used by the accepted answer, so I guess it's allowed!)

Jelly, 34 32  31 bytes

AḞbȷL’⁶;“£ṙƬs⁾`¬ụṂ“¢<ỴȦ8£l»j)⁹żY

A dyadic link (function) which takes a list of bank balances as numbers (decimals / integers) and a list of names as strings and returns a list of strings.

Try it online! - the footer çYsimply calls the function and joins the resulting list with line feeds so it has nice output when run as a full program.

How?

AḞbȷL’⁶;“£ṙƬs⁾`¬ụṂ“¢<ỴȦ8£l»j)⁹ż - Main link: bankBalances, names
                            )   - for each bankBalance:
A                               -   absolute value (treat negatives and positives the same)
 Ḟ                              -   floor (get rid of any pennies)
  bȷ                            -   convert to base 1000
    L                           -   length (number of digits in base 1000)
     ’                          -   decrement by one
      ⁶;                        -   concatenate a space with that   ...because -------.
        “         “       »     -   compressed list of strings:                       ↓
         £ṙƬs⁾`¬ụṂ              -     " is in the"  ← cannot compress a trailing space :(
                   ¢<ỴȦ8£l      -     "-comma club."
                           j    -   join that list of strings with the "number plus space"
                             ⁹  - right argument (names)
                              ż - zip with L

Japt, 36 bytes

This takes in the amount as the first input, name as the second.

V+`   e {w0 x4 l /3-2|0}-¬mµ club

Explanation

V+`   e {w0 x4 l /3-2|0}-¬mµ club
V+                                   // Second input +
  `                                  // compressed string:
      e                              // " is in the " 
        {              }             // Insert here:
         w0                          //   The larger of 0 and the first input
            x4                       //   Rounded to the 4th decimal
               l                     //   Length
                        -¬mµ club    // "-comma club"
                                     // A closing backtick is auto-inserted at the end of the program

Japt uses the shoco library for string compression.

Inspired by @Neil's solution.

Saved 7 bytes thanks to @ETHproductions

Try it online!

Java 8 154 141 bytes

m.keySet().stream().map(k->k+" is in the "+(((""+Math.abs(m.get(k).longValue()))).length()-1)/3+"-comma club.").forEach(System.out::println);

Ungolfed

public static void main(String[] args) {
    Map<String, Number> m = new LinkedHashMap<String, Number>(){{
        put("John", 100000);
        put("Jamie", 0.05);
        put("Kylie", 1549001.10);
        put("Laura", 999999999.99);
        put("Russ", 1000000000);
        put("Karla", 1);
        put("Reid", 99.99);
        put("Mark", 999.99);
        put("Manson", 1000.01);
        put("Lonnie", 999999999999.00);
        put("Nelly", -123.45);
    }};
    m.keySet().stream().map(k->k+" is in the "+(((""+Math.abs(m.get(k).longValue()))).length()-1)/3+"-comma club.").forEach(System.out::println);
}

Swift, 166 158 145 bytes

var c="comma club",i=0
f.map{k,v in var a=abs(v);print(k,(1000..<1000000~=a ?1:1000000..<1000000000~=a ?2:1000000000..<1000000000000~=a ?3:0),c)}

And here is the dictionary:

var f = [
    "John": 100000, "Jamie": 0.05, "Kylie" : 1549001.10,
    "Laura": 999999999.99,"Russ":1000000000,"Karla": 1,
    "Reid": 99.99,"Mark": 999.99, "Manson": 1000.01,
    "Lonnie": 999999999999.00, "Nelly": -123.45
]

Try it here!

Haskell, 71 bytes

n#a=n++" is in the "++(show.truncate.logBase 1e3.abs$a)++"-comma club."

Defines an operator '#' that provides the correct answer. E.g.:

*Main> "John"#100000
"John is in the 1-comma club."

Unfortunately, Haskell doesn't have a compact log10 function like many other languages, but it does have a useful logBase function, which means we don't need to divide our answer by 3. Unfortunately, logBase 1000 0.05 is a negative number, so we need to use the longer truncate rather than floor to round it.

Full program including test cases:

(#) :: (RealFrac n, Floating n) => [Char] -> n -> [Char]
n#a=n++" is in the "++(show.truncate.logBase 1e3.abs$a)++"-comma club."

testCases = [
 ("John",      100000),
 ("Jamie",     0.05),
 ("Kylie",     1549001.10),
 ("Laura",     999999999.99),
 ("Russ",      986000000),
 ("Karla",     1),
 ("Reid",      99.99),
 ("Mark",      999.99),
 ("Manson",    1000.01),
 ("Lonnie",    999999999999.00),
 ("Nelly",     -123.45)]

main = putStrLn $ unlines $ map (uncurry (#)) testCases

Gives the following results:

John is in the 1-comma club.
Jamie is in the 0-comma club.
Kylie is in the 2-comma club.
Laura is in the 2-comma club.
Russ is in the 2-comma club.
Karla is in the 0-comma club.
Reid is in the 0-comma club.
Mark is in the 0-comma club.
Manson is in the 1-comma club.
Lonnie is in the 3-comma club.
Nelly is in the 0-comma club.

dc, 56 54 bytes

[P[ is in the ]Pd*vdZrX-1-3/n[-comma club.]pstz0<g]sglgx

This takes input from the stack, which should be pre-loaded with the first name at top of stack, the first number, the second name, second number, etc.

Here is an example of loading the stack and running the macro, g:

#!/usr/bin/dc
_123.45         [Nelly]
999999999999.00 [Lonnie]
1000.01         [Manson]
999.99          [Mark]
99.99           [Reid]
1               [Karla]
986000000       [Russ]
999999999.99    [Laura]
1549001.10      [Kylie]
0.05            [Jamie]
100000          [John]
[P[ is in the ]Pd*v1/Z1-3/n[-comma club.]pstz0<g]sglgx

which produces the usual output,

John is in the 1-comma club.
Jamie is in the 0-comma club.
Kylie is in the 2-comma club.
Laura is in the 2-comma club.
Russ is in the 2-comma club.
Karla is in the 0-comma club.
Reid is in the 0-comma club.
Mark is in the 0-comma club.
Manson is in the 1-comma club.
Lonnie is in the 3-comma club.
Nelly is in the 0-comma club.

Here's an exegesis of the code:

[P[ is in the ]Pd*v1/Z-1-3/n[-comma club.]pstz0<g]sglgx

[                    # begin macro string
P                    # print and pop person name
[ is in the ]P       # print and pop ' is in the '
# Get absolute value of number by squaring and square root
d*v                  # d=dup, *=multiply, v=root
1/                   # 1/ truncates to integer since scale is 0
Z                    # Z=number length
1-3/n                # n=print and pop (#digits - 1)//3
[-comma club.]p      # print '-comma club.' and newline
st                   # pop '-comma club.' off stack into register t
z0<g                 # Do macro g if 0 is less than z=stack height
]                    # end macro string
sg                   # Save macro g
lgx                  # Load g and do its initial execution

Note, in edit 1 I replaced dZrX- (d=dup, Z=number length, r=swap, X=fraction, -=subtract) with 1/Z (divide number by 1, which with default scale of zero truncates to integer; then Z=number length), saving two bytes.

JavaScript, 59 bytes

Saved 3 bytes thanks to @ETHproductions

Saved 2 bytes thanks to @Cyoce

n=>m=>n+` is in the ${m>1?Math.log10(m)/3|0:0}-comma club.`

Demo

f=n=>m=>n+` is in the ${m>1?Math.log10(m)/3|0:0}-comma club.`

console.log((f("John")(100000)))
console.log((f("Jamie")(0.05)))
console.log((f("Kylie")(1549001.10)))
console.log((f("Laura")(999999999.99)))
console.log((f("Russ")(986000000)))
console.log((f("Karla")(1)))
console.log((f("Reid")(99.99)))
console.log((f("Mark")(999.99)))
console.log((f("Manson")(1000.01)))
console.log((f("Lonnie")(999999999999.00)))
console.log((f("Nelly")(-123.45)))

Rebol, 118 bytes

d: charset"0123456789"forskip s 2[c: 0 parse s/2[opt"-"any[3 d and d(++ c)]]print[s/1"is in the"join c"-comma club."]]

Ungolfed with array declaration:

s: [
    {John} {100000}
    {Jamie} {0.05}
    {Kylie} {1549001.10}
    {Laura} {999999999.99}
    {Russ} {986000000}
    {Karla} {1}
    {Reid} {99.99}
    {Mark} {999.99}
    {Manson} {1000.01}
    {Lonnie} {999999999999.00}
    {Nelly} {-123.45}
    {Baz} {1.12345678}     ;; added extra Baz test case
]

d: charset "0123456789"
forskip s 2 [
    c: 0
    parse s/2 [
        opt "-"
        any [3 d and d (++ c)]
    ]
    print [s/1 "is in the" join c "-comma club."]
]

Output:

John is in the 1-comma club.
Jamie is in the 0-comma club.
Kylie is in the 2-comma club.
Laura is in the 2-comma club.
Russ is in the 2-comma club.
Karla is in the 0-comma club.
Reid is in the 0-comma club.
Mark is in the 0-comma club.
Manson is in the 1-comma club.
Lonnie is in the 3-comma club.
Nelly is in the 0-comma club.
Baz is in the 0-comma club.

Powershell, 82 bytes

$args[0]|%{$_[0]+" is in the "+(('{0:N}'-f$_[1]-split',').Count-1)+"-comma club."}

Assuming a 2D-array input of

cc.ps1 @(@("John",100000),@("Jamie",0.05),@("Kylie",1549001.10),@("Laura",999999999.99),@("Russ",986000000),@("Karla",1),@("Reid",99.99),@("Mark",999.99),@("Manson",1000.01),@("Lonnie",999999999999.00),@("Nelly",-123.45))

The output is John is in the 1-comma club. Jamie is in the 0-comma club. Kylie is in the 2-comma club. Laura is in the 2-comma club. Russ is in the 2-comma club. Karla is in the 0-comma club. Reid is in the 0-comma club. Mark is in the 0-comma club. Manson is in the 1-comma club. Lonnie is in the 3-comma club. Nelly is in the 0-comma club.

Python 2, 69 bytes

Setup our arrays:

n = ['John', 'Jamie', 'Kylie', 'Laura', 'Russ', 'Karla', 'Reid', 'Mark', 'Manson', 'Lonnie']
a = [100000, 0.05, 1549001.10, 999999999.99, 1000000000, 1, 99.99, 999.99, 1000.01, 999999999999.00]

And our function can then be:

f=lambda n,a:'%s is in %s comma club'%(n,min(3,(len(str(int(a)))/3)))

Giving us:

>>> [f(x,y) for x,y in zip(n,a)]
['John is in 2 comma club', 'Jamie is in 0 comma club', 'Kylie is in 2 comma club', 'Laura is in 3 comma club', 'Russ is in 3 comma club', 'Karla is in 0 comma club', 'Reid is in 0 comma club', 'Mark is in 1 comma club', 'Manson is in 1 comma club', 'Lonnie is in 3 comma club']

If the array needs to be identical to that provided in the question, then the solution costs 76 bytes:

f=lambda n,a:'%s is in %s comma club'%(n,min(3,(len(str(int(float(a))))/3)))

Python 2, 87 bytes

for n,a in input():print n+' is in the %dd-comma club.'%'{:20,.2f}'.format(a).count(',')

Slightly older (90 bytes):

for n,a in input():print n+' is in the '+`'{:20,.2f}'.format(a).count(',')`+'-comma club.'

Takes input as a list of tuples (name, amount).

I'm doing this on my phone at school so I'll test it later.

PostgreSQL, 61 bytes

SELECT f||' is in the '||div(log(@a),3)||'-comma club.'FROM p

@x is the absolute value of x, log(x) is base-10 logarithm and div(y, x) computes the integer quotient of y/x.


Setup:

CREATE TEMP TABLE p AS
SELECT * FROM (VALUES
    ('John', 100000),
    ('Jamie', 0.05),
    ('Kylie', 1549001.10),
    ('Laura', 999999999.99),
    ('Russ', 986000000),
    ('Karla', 1),
    ('Reid', 99.99),
    ('Mark', 999.99),
    ('Manson', 1000.01),
    ('Lonnie', 999999999999.00),
    ('Nelly', -123.45)
) AS p (f, a)

Output:

            ?column?            
--------------------------------
 John is in the 1-comma club.
 Jamie is in the 0-comma club.
 Kylie is in the 2-comma club.
 Laura is in the 2-comma club.
 Russ is in the 2-comma club.
 Karla is in the 0-comma club.
 Reid is in the 0-comma club.
 Mark is in the 0-comma club.
 Manson is in the 1-comma club.
 Lonnie is in the 3-comma club.
 Nelly is in the 0-comma club.
(11 rows)

Perl 6, 107 95 bytes

for @f {printf "%s is in the %d-comma club.\n",@f[$++],(abs(@a[$++].split(".")[0]).chars-1)/3;}

Not my proudest work, give me a heads up if ive forgotten any golfing techniques. EDIT: -12 bytes thanks to @Ven

Clojure, 108 bytes

(def f ["John", "Jamie", "Kylie", "Laura", "Russ", "Karla", "Reid", "Mark", "Manson", "Lonnie", "Nelly"])
(def a ["100000", "0.05", "1549001.10", "999999999.99", "986000000", "1", "99.99", "999.99", "1000.01", "999999999999.00", "-123.45"])

(map #(str %" is in the "(quot(-(count(nth(partition-by #{\.}(drop-while #{\-}%2))0))1)3)"-comma club.")f a)

Not sure if operating on floats would be shorted than on sequences of characters. Not sure if non-function answer is fine which returns a sequence of answers.

R, 68 bytes

The setup:

f <- c('John', 'Jamie', 'Kylie', 'Laura', 'Russ', 'Karla', 'Reid', 'Mark', 'Manson', 'Lonnie', 'Nelly')
a <- c(100000, 0.05, 1549001.10, 999999999.99, 986000000, 1, 99.99, 999.99, 1000.01, 999999999999.00, -123.45)

The solution:

cat(paste0(f, " is in the ",floor(log10(abs(a))/3)),"-comma club.\n"))

Take the base 10 log of the absolute value of the account, round down then print with the names.

I'm not sure if it could be smaller if a would be a character vector...

Python 3 (207 159 110 95 86 bytes, thanks to @iwaseatenbyagrue)

A little bit of setup:

f = ['John', 'Jamie', 'Kylie', 'Laura', 'Russ', 'Karla', 'Reid', 'Mark', 'Manson', 'Lonnie', 'Nelly']
a = [100000, 0.05, 1549001.10, 999999999.99, 986000000, 1, 99.99, 999.99, 1000.01, 999999999999.00, -123.45]

My attempt:

['%s is in the %d-comma club.'%(p,-(-len(str(int(abs(v))))//3)-1) for p,v in zip(f,a)]

Results:

['John is in the 1-comma club.', 'Jamie is in the 0-comma club.', 'Kylie is in the 2-comma club.', 'Laura is in the 2-comma club.', 'Russ is in the 2-comma club.', 'Karla is in the 0-comma club.', 'Reid is in the 0-comma club.', 'Mark is in the 0-comma club.', 'Manson is in the 1-comma club.', 'Lonnie is in the 3-comma club.', 'Nelly is in the 0-comma club.']

Edit: converting everything to absolute values saved me 15 bytes.

JavaScript (ES6), 80 bytes

a=>a.map(([s,n])=>s+` is in the ${n.toFixed(n<0?3:4).length/3-2|0}-comma club.`)

Takes an array of [friend, amount] arrays and returns an array of "friend is in the n-comma club." strings. Works by adding extra trailing zeros so that the length is 6-8 for the 0-comma club, 9-11 for the 1-comma club, 12-15 for the 2-comma club etc.

https://jsfiddle.net/cau40vmk/1/

05AB1E, 32 bytes

Äï€g3/î<“-comma†Ú“«“€ˆ€†€€ “ì‚ø»

Try it online!

Explanation

Ä                                 # absolute value of input
 ï                                # convert to int
  €g                              # length of each
    3/                            # divided by 3
      î                           # round up
       <                          # decrement
        “-comma†Ú“«               # append string "-comma club" to each number
                   “€ˆ€†€€ “ì     # prepend string "is in the " to each number
                             ‚    # pair with second input
                              ø   # zip
                               »  # join by spaces and newlines

C#, 125 bytes

(p,n)=>{for(int x=0;x<p.Length;x++)Console.Write(p[x]+" is in the "+(n[x]<1e3?0:n[x]<1e6?1:n[x]<1e9?2:3)+"-comma club.\n");};

Anonymous function which prints the result in the the OP's format.

Full program with test cases:

using System;

class CommaClub
{
    static void Main()
    {
        Action<string[], double[]> f =
        (p,n)=>{for(int x=0;x<p.Length;x++)Console.Write(p[x]+" is in the "+(n[x]<1e3?0:n[x]<1e6?1:n[x]<1e9?2:3)+"-comma club.\n");};
        
        // test cases:
        string[] personArr = new[] {"John", "Jamie", "Kylie", "Laura", "Russ", "Karla", "Reid", "Mark", "Manson", "Lonnie", "Nelly"};
        double[] amountArr = new[] {100000, 0.05, 1549001.10, 999999999.99, 1000000000, 1, 99.99, 999.99, 1000.01, 999999999999.00, -123.45};
        f(personArr, amountArr);
    }
}

Mathematica (86 bytes)

The set-up (with names as strings, money as numbers):

n = {"John", "Jamie", "Kylie", "Laura", "Russ", "Karla", "Reid", "Mark", "Manson", "Lonnie", "Nelly"};
m = {100000, 0.05, 1549001.10, 999999999.99, 1000000000, 1, 99.99, 999.99, 1000.01, 999999999999.00, -123.45}

The attempt:

MapThread[#~~" is in the "~~ToString@Max[Floor@Log[10^3,#2],0]~~"-comma club."&,{n,m}]

All of Mathematica's string functions include "String" in the name, so I think logs are shorter. The Max[...,0] is to deal with the pesky negative numbers or negative infinity for people who own between -1 and 1 dollars. The log of a negative number includes imaginary stuff, but Mathematica helpfully ignores that when taking a Floor!

K, 66 bytes

    /n is names and a is amounts
    n
    ("John";"Jamie";"Kylie";"Laura";"Russ";"Karla";"Reid";"Mark";"Manson";"Lonnie")
    a
    ("100000";"0.05";"1549001.10";"999999999.99";"1000000000";,"1";"99.99";"999.99";"1000.01";"999999999999.00")
    /the function
    {x," is in the ",($(#.q.cut[3;*"."\:y])-1)," comma club"}./:+(n;a)
    /output
    ("John is in the 1 comma club";"Jamie is in the 0 comma club";"Kylie is in the 2 comma club";"Laura is in the 2 comma club";"Russ is in the 3 comma club";"Karla is in the 0 comma club";"Reid is in the 0 comma club";"Mark is in the 0 comma club";"Manson is in the 1 comma club";"Lonnie is in the 3 comma club")

Vim, 72 bytes

:%s;\v +\-=(\d+).*;\=' is in the '.(len(submatch(1))-1)/3.' comma club'

Somehow I should show that there's a trailing return, but unsure how. This is just a basic regex answer, that I'm sure could be beaten by any regex language. I would have used V, but I think that the substitute commands in V use / as a separator by default, and I couldn't figure out how to make it not complain about the divide.

Takes input as OP's table, and returns values as the table, but with the financial information replaced by " is in the X comma club"

Try it online!

PHP, 76 74 bytes

// data as associative array
$d=[Poorman=>-1234,John=>100000,Jamie=>0.05,Kylie=>1549001.10,Laura=>999999999.99,Russ=>1000000000,Karla=>1,Reid=>99.99,Mark=>999.99,Manson=>1000.01,Lonnie=>999999999999.00];
// code
foreach($d as$n=>$a)printf("$n is in the %d-comma club.
",log($a*$a,1e6));

Fortunately I don´t have to cast to int (as I would have to in C); PHP does that implicitly for %d.