readability – Is using a comma as a number separator a cultural thing?

On my Linux there’s a file for each locale. A quick search on them showed that these countries use a comma as thousand separator:

Algeria, Armenia, Australia, Bahrain, Bangladesh, Bhutan, Cambodia, Canada, China, Egypt, Ethiopia, Hong Kong, India, Iran, Islamic Republic Of, Iraq, Ireland, Israel, Jordan, Kenya, Kuwait, Lao People’s Democratic Republic, Lebanon, Libyan Arab Jamahiriya, Malaysia, Maldives, Malta, Morocco, Myanmar, Nepal, New Zealand, Nigeria, Oman, Pakistan, Philippines, Qatar, Singapore, Somalia, Sri Lanka, Sudan, Syrian Arab Republic, Taiwan, Province Of China, Thailand, Tunisia, Turkmenistan, Uganda, United Arab Emirates, United Kingdom, United States, Uzbekistan, Yemen, Zambia.

ASP.Net core razor – looping through HTML table, how to comma separate the values and sent to JavaScript function

I am using ASP.Net core with razor pages.

I have a table in html, and using razor syntax looping the class object in this HTML table, as code below.

Now I want to get the values while looping the table, save / concatenate with comma separated the values through the looping and send it as a variable to a JavaScript function. This save/ concatenate and send it as a variable to a JavaScript function part I am not sure how to do. Any help would be grateful.

 <div>
            @if (Model.EmployeeDetails != null)
            {
                <table id="EmpDetail" class="table table-bordered">
                    <thead>
                        <tr>
                            <th style="width: 30%">Name</th>
                            <th style="width: 70%">Age</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (DTO.Employee emp in Model.EmployeeDetails)
                        {
                            <tr>
                                <td style="width: 30%">@emp.name</td> 
// Here I need to concatenate with comma separation to a variable 
and after the looping ends send to javascript function
                                <td style="width: 70%">@emp.age</td>
                            </tr>
                        }
                    </tbody>
                </table>
            }
        </div>

<script type="text/javascript">jsFunctionCall("variableCommaSeperatedValues");</script> // here is the JavaScript 
function call with paramter conatianing comma separated values from above 
``````````

catalina – Remove comma at end of line in sed on MacOS?

I created a file in TextEdit on the Mac called stuff.txt:

stuff and stuff
More stuff
Stuff with a , in the middle
Stuff with a comma at the end,
More stuff

If I run this command:

cat stuff.txt | sed 's/,$//'

then the output is

stuff and stuff
More stuff
Stuff with a , in the middle
Stuff with a comma at the end
More stuff

I have another file created by grepping various .eml files created by Save As in Thunderbird on the Mac:

grep '@' *.eml | grep -v 'From' | grep -v 'Message-ID' | sed 's/^.*: //' > output.txt

Running cat output.txt | sed 's/,$//'
does not remove final commas. Help?

sharepoint online – How to separate ‘Person or Group’ column values by a comma and display on one line?

When you select multiple Persons from a Person or Group column in a SharePoint List, each value will be displayed on its own line, eg:

Person_01  
Person_02  

However, a Choice column that allows multiple selections will display selected options as:

Some_Choice_01, Some_Choice_02, Some_Choice_03

Person or Group columns are supported in column formatting:

Supported column types

Is there a way to display multiple Persons separated by commas, so that they can be displayed on one line?

This answer provides a solution for multiple options being selected in a Managed Metadata column:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "=join(@currentField, ', ')"
}

However, when applied to a Person or Group column it outputs this:

(object Object), (object Object)

Can the Oracle-Text OR be replaced with a comma?

I have incorporated user-accessible Oracle-Text functionality within my application and I noticed that the comma , can be used in place of OR or the pipe | character.

Searching on ‘red OR green OR blue’ returns the same results as ‘red|green|blue’ or ‘red,green,blue’.

I reviewed the Oracle-Text Contains documentation and tried my favourite search engine but I did not find any documentation to support or negate my findings and the comma , is never mentioned.

I would like to mention the comma , as an option for my users but don’t want to without some supporting documentation.

Use comma as decimal separator in form based on Google Sheets?

I have seen this question but my question is different. My sheet uses comma as decimal separator but when I publish it as a form, dot is used as the decimal separator.

How do I change decimal separator in a form based on a Google Sheet?

When viewing/editing the form I have looked under the ⚙️- and ⋮-menus but couldn’t find anything that looked applicable there.

Interesting tidbit: I have enabled response validation in the form as well as data validation in the actual sheet. The condition is a value between 1,0 and 2,0 – but in the form these values aren’t accepted, instead I have to enter 1.0 and 2.0 as limits.

If I enter 1,5 in the form it is rejected, I have to enter 1.5. But when I look in the sheet, 1.5 is rejected – I have to change it to 1,5 for it to be accepted.

google sheets – How to set a locale to use comma as decimal separator and Euro as currency symbol by default

Here is my issue :

  • We work in English
  • We are a French company : we want Euro as default currency…
  • … and the “French formatting” for dates (dd/mm/yyyy) and numbers (1 thousand = 1 000,00 ; not 1,000.00).
.. Which is by the way, the standard in continental Europe if I am correct.

I cannot get the default language and country to work correctly :

  • I set defaults that should work (language = English, country = whatever country in continental Europe) in : myaccount / language (as found on Google support page)
  • … But when I create a new Spreadsheet (from Drive > new spreadsheet) it is created as “locale = UK” (hence currency is £/GBP, I want Euro). And this is for every country in continental Europe… 
The only country that is not switched to UK is Ireland, but the numbers formatting is not what I want (problem with comas “,”).

This matters because as comas are not used similarly, it is “a small pain every time we copy/paste figures”, same with dates. Hence we change every single new document’s locale.
1 min on almost every new Spreadsheet to understand why your formulas don’t work and manually correct, this is irritating!


For references, I have looked at these webapps.stackexchange questions that seem close but do not address this specific problem:


And also for the reference, a similar question on support.google.com/docs/:

Macro that only contains a comma in C++

I’m trying to make a foreach loop in C++. I have defined two macros: in and foreach.

#define in ,
#define foreach(var, collection) // long code here

The foreach macro works well… with a normal comma as an argument separator.

foreach (test, my_array) {/* macro expands correctly */}

It expands to this:

for (auto (i, test) = std::tuple{0, my_array(0)};
     i < sizeof(my_array) / sizeof(*my_array); 
     i++, test = my_array(i))

But when I use the in macro…

foreach (test in my_array) {/* does not expand correctly */}

var and collection are seemingly “concatenated”. On VS Code, using in in the foreach macro expands to this:

// Note: 'test' is var, and 'my_array' is collection (in the macro)
for (auto (i, test , my_array /* my_array should not be included here */ ) = std::tuple{0, /* missing array name */ (0)}; 
     i < sizeof(/* missing array name again, my_array should be here */) / sizeof(* /* missing array name again, *my_array should be here */); 
     i++, test , my_array /* again, only test should be here. */ = /* my_array should be here */ (i))

Any ideas why this is happening? Thank you.

javascript – Comma Operator, Arrow Functions and Single Line Auto Returns

I am a self-taught hobby programmer and want to improve. I spent the morning reading as much hints and tips of the trade and have read about functional programming and array functions in javascript. I have never really used array functions before except things like indexOf. This looks fun, so I have tried (and succeeded) in rewriting one of my functions that produces a random string of alpha-numeric characters in the form:

A4b-c56-7de

Ie, 9 upper and lower letters/numbers, separated in groups of 3 with a ‘-‘ in between. However, since I need this for other generic stuff later on, the function accepts as arguments, the number of letters (eg 9) and the number in the group (eg 3).

I am reasonably happy, but not quite. I would also like any constructive criticism, so I can become better.

I generate an array of the permissible characters, excluding ‘o’, ‘O’ and ‘0’, because the user has to type this code in and these letters are hard to determine on a phone.

Here is how I generate my array of permissible characters:

// (0-9a-zA-Z) but excluding o, 0 and O that look the same
var myChars = (... Array(10+2*26))
            .map((_, idx) => {
                var bl, ret;
                return (bl = idx >= 36, ret = (idx - (bl ? 26 : 0)).toString(36), bl && (ret = ret.toUpperCase()), ret);
            })
            .filter(val => !("o","O","0").includes(val));

I do not like the map here. I wanted the auto-return, ie where there is only one statement, so you do not need to write the return. I tried to use the comma operator I had read about this morning. The last thing will be the thing returned. However, you cannot appear to declare variables, bl and ret within the comma operator. That means you have to write a second line, which means you do not get the auto return. :(.

You can obviously introduce a second map into the code to do the upper case. Is this good, is this bad? As a hobby programmer, I do not have anyone to say which is better.

I could do:

// (0-9a-zA-Z) but excluding o, 0 and O that look the same
var myChars = (... Array(10+2*26))
            .map((_, idx) => (idx - (idx >= 36 ? 26 : 0)).toString(36))
            .map((val, idx) => idx >= 36 ? val.toUpperCase() : val)
            .filter(val => !("o","O","0").includes(val));

This obviously looks a million times nicer and is easy for a third-party to read and understand. But is it as fast, is it better code?

As for the random string generator, I found that a lot easier to write, again using the comma operator I discovered this morning so I can get the auto return:

function CreateMyRandomId(numLetters, numInGroup) {
    return (... Array(numLetters))
            .map(() => myChars((Math.random() * myChars.length) | 0))
            .reduce((endArr, curVal, curIdx /*, arr not needed*/) =>
                // Left most thing in (, ) is what is returned
                (endArr((curIdx / numInGroup) | 0).push(curVal), endArr),
            //(... Array(Math.ceil(numLetters / numInGroup))).fill(()))
            (... Array(Math.ceil(numLetters / numInGroup))).map(() => ()))
            .map(curMiniArr => curMiniArr.join(''))
            .join('-');
}

I am not happy having to use Math.ceil. Math.floor can be replicated for (max bitwise safe range) floats by doing myFloat | 0. There must be something that can be done for ceil. (I have had an idea, maybe -(~myFloat), or something on those lines. I am going to try to think of something later.

I had to create the mini arrays holding 3 letters each. I set those up at the start, and have left my mistake in (hashed out to remind me later). When I did (... Array(Math.ceil(numLetters / numInGroup))).fill(()) that used the same array for each of the mini arrays, which was wrong. I had to do (... Array(Math.ceil(numLetters / numInGroup))).map(() => ()) instead to get unique mini arrays.

The function is run with:

var str = CreateMyRandomId(9, 3);

Again, any criticism of this would be much appreciated. I want to get better. I aspire to be as good as all the people on here who answer these type of questions. I aspire to be a guy who answers these questions for others.