numbers

C# regex for assembly style hex numbers

Deadly 提交于 2019-12-23 22:19:24
问题 I'm new to regex and I want to highlight hexadecimal numbers in Assembly style. Like this: $00 $FF $1234 ($00) ($00,x) and even hexadecimal numbers that begin with #. So far I wrote "$[A-Fa-f0-9]+" to see if it highlights numbers beginning with $ but it doesn't. Why? And can someone help me with what I'm doing? Thanks. 回答1: Put a back slash before $ and your regex will work like so \$[A-Fa-f0-9]+ $ is a valid regex character that matches with end of string. So if your pattern contains dollar

Difference between Objective-C primitive numbers

落爺英雄遲暮 提交于 2019-12-23 21:40:45
问题 What is the difference between objective-c C primitive numbers? I know what they are and how to use them (somewhat), but I'm not sure what the capabilities and uses of each one is. Could anyone clear up which ones are best for some scenarios and not others? int float double long short What can I store with each one? I know that some can store more precise numbers and some can only store whole numbers. Say for example I wanted to store a latitude (possibly retrieved from a CLLocation object),

generatesDecimalNumbers for NumberFormatter does not work

风流意气都作罢 提交于 2019-12-23 17:24:54
问题 My function is converting a string to Decimal func getDecimalFromString(_ strValue: String) -> NSDecimalNumber { let formatter = NumberFormatter() formatter.maximumFractionDigits = 1 formatter.generatesDecimalNumbers = true return formatter.number(from: strValue) as? NSDecimalNumber ?? 0 } But it is not working as per expectation. Sometimes it's returning like Optional(8.300000000000001) Optional(8.199999999999999) instead of 8.3 or 8.2. In the string, I have value like "8.3" or "8.2" but the

Display Rownum issue MySQL

两盒软妹~` 提交于 2019-12-23 17:09:30
问题 I have this Query: SET @row_num = 0; SELECT (SELECT @row_num := @row_num + 1) AS itempurchase_code, (SELECT supplier_code FROM qa_items_purchases a WHERE a.item_invoicecodesupplier = b.item_invoicecodesupplier GROUP BY supplier_code ORDER BY COUNT(*) DESC LIMIT 1) AS supplier_code, (SELECT user_code FROM qa_items_purchases a WHERE a.item_invoicecodesupplier = b.item_invoicecodesupplier GROUP BY user_code ORDER BY COUNT(*) DESC LIMIT 1) AS user_code, 22 AS status_code, item_invoicecodesupplier

How to split a number into its digits in APL

a 夏天 提交于 2019-12-23 17:05:17
问题 In APL, how can I split an integer or number into a vector containing its digits? What is the most concise (shortest) way of doing this? 回答1: You can use the inverse of Decode with base 10: 10⊥⍣¯1⊢ since Decode would take in as many digits as needed and decode them, its inverse would take a number and encode it to as many digits as needed, or, with ⎕IO←0 , you can try to find the indexes of the formatted number inside the digits vector: ⎕D⍳⍕ Demo for both solutions. This is better than the

how to allow only specific number in edittext?

删除回忆录丶 提交于 2019-12-23 15:50:31
问题 am trying to put only a specific value in my edit text. I have used this this my layout. android:digits="0123468" however, i also do not want that number 1 and 3 should work in my edit text. Sample; enter 32... it gives me a list of items but enter 3 should not allow me to do something. Can someone help me on this? 回答1: This could be an aproach: <EditText android:id="@+id/edtNumber" android:digits="0123456789" android:inputType="number" /> And if you want to discard '1' and '3' you could get

Android soft keyboard show numbers view first

佐手、 提交于 2019-12-23 15:19:44
问题 I have a login screen on my app which accepts a CPF as login (CPF is an unique number identification that every Brazilian citizen have, e.g: 10546819546), but it can also accept passport numbers as the login, and these may have letters on it. My problem is that I want the keyboard, when it pops up, to show to number/symbols "view" before the default alphabet one. Changing the inputMethod to phone or number does not solve my problem, because as I said, the login may contain letters. I've seen

How can I convert a string like 3 10^-20 into a number in Perl?

匆匆过客 提交于 2019-12-23 14:04:14
问题 I have a file that contain list of numbers that looks like this: 10^-92 2 10^-14 10^-105 3 10^-20 To explain a bit further 10^-92 is essentially 1E-92 and 2 10^-14 is 2E^-14 . Is there a compact way to convert the number in above file into Perl number? At the end I want to sort these numbers numerically. 回答1: If all your numbers require the same transform to become numeric to Perl, why not use a regex substitution: use 5.010; my @nums = ('10^-92', '2 10^-14', '10^-105', '3 10^-20'); s{ (\d*)

How can I convert a string like 3 10^-20 into a number in Perl?

自作多情 提交于 2019-12-23 14:04:05
问题 I have a file that contain list of numbers that looks like this: 10^-92 2 10^-14 10^-105 3 10^-20 To explain a bit further 10^-92 is essentially 1E-92 and 2 10^-14 is 2E^-14 . Is there a compact way to convert the number in above file into Perl number? At the end I want to sort these numbers numerically. 回答1: If all your numbers require the same transform to become numeric to Perl, why not use a regex substitution: use 5.010; my @nums = ('10^-92', '2 10^-14', '10^-105', '3 10^-20'); s{ (\d*)

Parsing prices with Currency Symbol in Java

倖福魔咒の 提交于 2019-12-23 12:56:41
问题 I want to parse a String that i have into a Number. This is the Code that i'm using but not working: NumberFormat.getCurrencyInstance(Locale.GERMAN).parse("EUR 0,00"); This results in a java.text.ParseException So i want to match the String into a number, i don't really care about the currency, but it would be nice to have. I want the following kind of Strings matched: EUR 0,00 EUR 1.432,89 $0.00 $1,123.42 1,123.42$ 1,123.42 USD Sure, there are ways with RegEx, but i think it would be kind of