Questions tagged [digits]

Questions dealing with getting, manipulating, or changing the digits of numbers

Use this tag for questions dealing with getting, manipulating, or changing the digits of numbers. More about digits on wikipedia

1098 questions
3
votes
4 answers

Return/print amount of digits in a sentence OR an error message

I'm new to the site and to python so I hope I'm giving all the required information. I've already searched for this question but none of the solutions seem to work for me. I'm trying to create a function that reads some text and returns the amount…
JotaSolano
  • 65
  • 9
3
votes
1 answer

Javascript Regex for Javascript Regex and Digits

The title might seem a bit recursive, and indeed it is. I am working on a Javascript which can highlight/color Javascript code displayed in HTML. Thus, in the Internet Browser, comments will be turned green, definitions (for, if, while, etc.) will…
Kafoso
  • 534
  • 3
  • 20
3
votes
1 answer

Why does `options(digits=3)` get ignored in `knitr'?

When I run the following line by line in R it works fine, but with knitr the options(digits=3) gets ignored. Why? Any solutions? <>= #mock up data set. x <- c(rnorm(100)) y <- c(rnorm(100)) z <- c(rnorm(100)) df <-…
Gerit
  • 195
  • 2
  • 14
3
votes
1 answer

find files using regex with exact digits number

I'm trying to find all files on linux that would match files like these: frontend_prod_20100112.log frontend_prod_20110101.log frontend_prod_20120101.log frontend_prod_20121231.log the only variable here is 8 digits inside (exactly 8). I'm trying…
ducin
  • 25,621
  • 41
  • 157
  • 256
3
votes
3 answers

Adding one digit (0-9) to the sequence/string creates new 4 digits number

I'm trying to find an algorithm which "breaks the safe" by typing the keys 0-9. The code is 4 digits long. The safe will be open where it identifies the code as substring of the typing. meaning, if the code is "3456" so the next typing will open the…
elirandav
  • 1,913
  • 19
  • 27
3
votes
1 answer

Biggest possible number from given blocks of digits C++

For given number of blocks of digits (number of blocks is bigger than 2 and smaller than 1000), print the biggest possible number. Here's a little example: input: 5 // Number of blocks of digits 9 // first block 98 // second 90 // third 5 //…
Stefan4024
  • 694
  • 1
  • 10
  • 21
3
votes
4 answers

Remove values with digit only from array - PHP

I have an array like so array( 1=>hello, 2=>foo, 3=>192, 4=>keep characters AND digits like a1e2r5, ); All I want to do is to remove rows containing digits ONLY (3=>192), and return an array like this one : array( …
Neoweiter
  • 814
  • 2
  • 9
  • 17
2
votes
5 answers

How to separate digits from a number in C++?

I'm trying to find a way to get 5 digits separately from a whole number. cin >> option; // Option to enter a number(don't worry about this) if (option == 1) // The option(don't worry) { cout << " enter 5 digit key 0 to 9 \n"; …
lakam99
  • 575
  • 4
  • 9
  • 24
2
votes
6 answers

Define a function using a variable?

I am trying to define a function that will include a variable n where n will be a string of numbers e.g. "3884892993", the definition of the function starts as is_true(n), however if n is going to be a string should it be is_true(n) and then once…
George Burrows
  • 3,391
  • 9
  • 31
  • 31
2
votes
3 answers

How to manipulate digits within an integer/string?

I am looking for a general way to refer to particular digits in a integer or string, I need to be able to perform different operations on alternating digits and sum the result of all of those returned values. Any help is much appreciated Oh and I am…
George Burrows
  • 3,391
  • 9
  • 31
  • 31
2
votes
3 answers

Rotate digits of an integer

I am attempting to come up with a generic function that will rotate the digits of a given number to the left or the right by n. At this point I've only been able to work out an implementation for left shift: public static T RotateDigitsLeft(this…
Kittoes0124
  • 4,930
  • 3
  • 26
  • 47
2
votes
3 answers

Separating numbers using %

I am trying to get 3 numbers separated by a space after user's input. I can get the first number and the last one dividing by 10, but I really have no idea how to get the middle number I tried to take the remainder of the first two numbers and then…
2
votes
2 answers

How do these two while loops to separate an integer into digits work?

The code is about to separate an integer into digits, the code works, but I am having trouble with how the two "while" work together. #include int main() { int num, temp, factor = 1; printf("Enter a 5 digit number: "); …
2
votes
2 answers

Find and Replace multiple digits with the last character in notepad++

Does anyone know how to replace several different Digits all at once in notepad++. For example, I have 4 different Digits; 1000x1000.jpg 750x750.jpg 1000x750.jpg 750x1000.jpg I want the result like this: 1000x1000.jpg 1000 650x550.jpg…
EnigmaOs
  • 25
  • 4
2
votes
1 answer

Adjust number of digits for small pvalue to be displayed in title of a plot using renderPlot in Shiny in R

In R one can use options(digits=n) to adjust the number of digits in the output value. However, this does not work in Shiny, and sprintf() does not work with very low numbers either since it would only display zeros. So, how could i obtain in Shiny…
ForEverNewbie
  • 357
  • 2
  • 10