locale

Negative floating point numbers are not sorted correctly using awk or sort

谁都会走 提交于 2020-05-11 12:53:59
问题 For some reason, comparisons of negative floating point numbers with awk and sort seem to be broken on my machine. It seems that -0.1 < -0.2 . When I try to sort 0.2 -0.1 -0.2 0.1 0 using sort -n test.dat , I get -0.1 -0.2 0 0.1 0.2 instead of -0.2 -0.1 0 0.1 0.2 What is wrong with me? 回答1: Answer: You are French! In french, the decimal point is a comma ( , ) and not a dot ( . ). You need to either replace the dots with commas or change your locale. Try LC_NUMERIC=us_EN.UTF-8 sort -n test.dat

Perl + Curses: Expecting a UTF-8 encoded multibyte character from getchar(), but not getting any

孤街浪徒 提交于 2020-04-30 06:26:20
问题 I am trying out Bryan Henderson's Perl interface to the ncurses library: Curses For a simple exercise, I try to obtain single characters typed on-screen. This is directly based off the NCURSES Programming HOWTO, with adaptations. When I call the Perl library's getchar() , I expect to receive a character, possibly multibyte (It's a bit more complicated as explained in this part of the library manpage because one has to handle the special cases of function keys and no input, but that's just the

Get the currency symbol for a locale

核能气质少年 提交于 2020-04-07 09:40:29
问题 How to get the currency symbol for a given currency string ("GBP", "USD" etc)? The best I've come up with seems ridiculously long winded, is there another way or am I better off with a lookup table? const userLocale = "EN-gb"; const userCurrency = "GBP"; const withValueEl = document.querySelector(".withValue"); const withoutValueEl = document.querySelector(".withoutValue"); const valueWithCurrency = Number(0).toLocaleString(userLocale, { style: "currency", currency: userCurrency,

Perl + Curses: Expecting a UTF-8 encoded multibyte character from getchar(), but not getting any

这一生的挚爱 提交于 2020-04-07 05:13:37
问题 I am trying out Bryan Henderson's Perl interface to the ncurses library: Curses For a simple exercise, I try to obtain single characters typed on-screen. This is directly based off the NCURSES Programming HOWTO, with adaptations. When I call the Perl library's getchar() , I expect to receive a character, possibly multibyte (It's a bit more complicated as explained in this part of the library manpage because one has to handle the special cases of function keys and no input, but that's just the

Perl + Curses: Expecting a UTF-8 encoded multibyte character from getchar(), but not getting any

笑着哭i 提交于 2020-04-07 05:13:31
问题 I am trying out Bryan Henderson's Perl interface to the ncurses library: Curses For a simple exercise, I try to obtain single characters typed on-screen. This is directly based off the NCURSES Programming HOWTO, with adaptations. When I call the Perl library's getchar() , I expect to receive a character, possibly multibyte (It's a bit more complicated as explained in this part of the library manpage because one has to handle the special cases of function keys and no input, but that's just the

How to re-order a List<String>

孤街醉人 提交于 2020-03-25 13:59:20
问题 I have created the following method: public List<String> listAll() { List worldCountriesByLocal = new ArrayList(); for (Locale locale : Locale.getAvailableLocales()) { final String isoCountry = locale.getDisplayCountry(); if (isoCountry.length() > 0) { worldCountriesByLocal.add(isoCountry); Collections.sort(worldCountriesByLocal); } } return worldCountriesByLocal; } Its pretty simple and it returns a list of world countries in the users locale. I then sort it to get it alphabetic. This all

How to remove comma between date and time on toLocaleString() in Js

你说的曾经没有我的故事 提交于 2020-03-23 02:07:26
问题 var date ="03/05/2013"; var localDate = date.split("/").reverse().join("-"); var localTime = "20:41" var UTCDateTime = localDate+ "T" + localTime +":00.000Z"; localDateTime = new Date(UTCDateTime) var options = { hour12: false, day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute:'2-digit' }; console.log("Date:>>"+localDateTime.toLocaleString('en', options)); How do you remove comma after date Date:>>05/03/2013 21:41 回答1: I wouldn't replace the comma with either the

How to remove comma between date and time on toLocaleString() in Js

删除回忆录丶 提交于 2020-03-23 02:04:29
问题 var date ="03/05/2013"; var localDate = date.split("/").reverse().join("-"); var localTime = "20:41" var UTCDateTime = localDate+ "T" + localTime +":00.000Z"; localDateTime = new Date(UTCDateTime) var options = { hour12: false, day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute:'2-digit' }; console.log("Date:>>"+localDateTime.toLocaleString('en', options)); How do you remove comma after date Date:>>05/03/2013 21:41 回答1: I wouldn't replace the comma with either the

Change Language of the application programmatically without refreshing the whole app

こ雲淡風輕ζ 提交于 2020-03-05 04:27:46
问题 I'm trying to change the language of the application according to the user's input. I tried using this code to change the language of the application and it's working pretty fine. public void setLocale(String lang) { myLocale = new Locale(lang); Resources res = getResources(); DisplayMetrics dm = res.getDisplayMetrics(); Configuration conf = res.getConfiguration(); conf.locale = myLocale; res.updateConfiguration(conf, dm); Intent refresh = new Intent(MainActivity.this, MainActivity.class);

Change Language of the application programmatically without refreshing the whole app

吃可爱长大的小学妹 提交于 2020-03-05 04:27:13
问题 I'm trying to change the language of the application according to the user's input. I tried using this code to change the language of the application and it's working pretty fine. public void setLocale(String lang) { myLocale = new Locale(lang); Resources res = getResources(); DisplayMetrics dm = res.getDisplayMetrics(); Configuration conf = res.getConfiguration(); conf.locale = myLocale; res.updateConfiguration(conf, dm); Intent refresh = new Intent(MainActivity.this, MainActivity.class);