Questions tagged [digit]

Anything related to numerical digits, i.e. the symbols used to write the representation of a number in a number system, such as decimal, hexadecimal, octal or binary systems.

Anything related to numerical digits, i.e. the symbols used to write the representation of a number in a number system, such as decimal, hexadecimal, octal or binary systems.

See Wikipedia page on numerical digits.

375 questions
2
votes
1 answer

Making BBP algorithm for Java, computing nth digit

I have started a java project for computing the n-th digit of pi, and decided to use the BBP algorithm. In my output (in another class) I have been getting some weird math errors, and I don't know where it is from. So, I don't think I am putting the…
2
votes
2 answers

Second digit from the right from a huge number

Now I actually read about modular arithmetic and managed to get the last digit of some number. Okay. But now... How do I get second last digit? Second one on the right. I actually been working on it on several hours straight trying to find a simple…
ImQ009
  • 325
  • 4
  • 12
2
votes
2 answers

RegEx: Match "year:2012" anywhere in a string?

I'm working on a search engine, and i need the user to be able to filter the results by year. I want the user to be able to add "year:(four digits)" anywhere in the search string. I created this but it's not quite what i want: (year\:\d{4}) It does…
qwerty
  • 5,166
  • 17
  • 56
  • 77
2
votes
2 answers

(C++) Reading digits from text file

I have a text file which looks like this: 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 and etc. 20 lines in total. What I want to do is…
user1242967
  • 1,220
  • 3
  • 18
  • 30
2
votes
6 answers

Length of specific substring

I check if my string begins with number using if(RegEx(IsMatch(myString, @"\d+"))) ... If this condition holds I want to get the length of this "numeric" substring that my string begins with. I can find the length checking if every next character…
superM
  • 8,605
  • 8
  • 42
  • 51
2
votes
3 answers

Javascript RegEx Exactly one Digit Pattern

str = "33d4m"; //d for days and h for hours and m for min patt=/^[1-9]+d/i; result=patt.test(str); document.write("Returned value: " + result); I want result return true if and only if there is one digit before d, i.e;less than 10days remaining or…
Wasim A.
  • 9,660
  • 22
  • 90
  • 120
1
vote
1 answer

jquery - single digit numbers should start with 0

Hi I am wondering is there anyway to make a single digit number ie:1 become 01 This is the code I using at the moment but all the single digits are only coming out as single digits setTimeout(function() { if(a == "hh") …
RussellHarrower
  • 6,470
  • 21
  • 102
  • 204
1
vote
3 answers

How do you test whether a tab is active with dojo tabs

How do you test whether a tab is active or not with a dojo tab container? (In JQuery this is simple... you can use something like this if($("#accordion").accordion('option', 'active') == mytabNumber){ With dojo's, dijit.layout.TabContainer …
lance
  • 43
  • 1
  • 9
1
vote
2 answers

Separating numbers (in a single line array) with more than 2 digits into several columns

Is there a way to separate `vector=[0345;0230;0540;2340]` into `vec_1=[03;02;05;23]` and `vec_2=[45;30;40;40]`
straits
  • 315
  • 1
  • 4
  • 15
1
vote
1 answer

How can System.currentTimeMillis return longs with different lengths in a short period of time?

I'm creating temporary directories with Files.createTempDirectory(String.format("project-it-screenshots-%d", System.currentTimeMillis())).toFile(); an I assumed that the longs returned by System.currentTimeMillis() all have the same length…
Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
1
vote
3 answers

Recursive function to reverse the digit of an integer number

My goal is to write a recursive program that reverse the digits of an integer number. When I test the first element, the code works. However, it doesn't work well for the other two cases, e.g. it for reverse(456) it prints 321654 and for…
FunnyBuzer
  • 313
  • 2
  • 14
1
vote
3 answers

scala..how to check is not a digit on a character

I need to do a char conversion like this: accountNumber => ACCOUNT_NUMBER Where there is a caps letter, then prefix a underscore. If not, just capitalize the character I tried like below scala> "accountNumber".map{ x => x match { case x if x ==…
stack0114106
  • 8,534
  • 3
  • 13
  • 38
1
vote
2 answers

How to create a number with N digits in Batch Script Windows?

I would like to create a number with N digits. Example; myVar=543 and I would like it with 6 digits so myVar will be 000543 myVar=44345 will be 044345 myVar=1 will be 0000001 ... I do that with Batch, so just with Windows Batch commands.
user7127267
1
vote
0 answers

r: How to keep the same number of decimal places when changing column type from to ?

I am doing an R course that uses Swirl. I am in chapter 12 of the R Programming Environment - Data Manipulation. I am stuck on the final problem about the Titanic Survivors. I began with code from the previous question, which creates the first…
user9237696
1
vote
1 answer

C# converting decimal to string by seperating digits

decimal value = 10000; var str = value.ToString("N0").Replace(",","."); Output : 10.000 Is there a better way to seperate digits without using Replace ?