As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [isnumeric]

Determines whether an expression is a valid numeric type.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
30 views

Is PHP's is_numeric() function effective against directory traversal attacks? [duplicate]

I am working on a penetration testing report for one of my PHP projects and am currently assessing its vulnerability to directory traversal (or path traversal) attacks. Below is a snippet of the code ...
Márk Matuz's user avatar
0 votes
1 answer
51 views

Why is there an attribute error: int object has no attribute 'isnumeric'?

I am currently creating a program which will ask the user to enter a year and then states whether it is a leap year or not by seeing if the year is divisible by 4. It also has a type check, presence ...
Azalea-Delphinium's user avatar
0 votes
1 answer
55 views

Allow alpha numeric values instead of isnumeric

I have the below code for entering a function and copying the orientation and borders of the above line. But in this it only accept numeric values, how can i modify the code so that i can enter alpa ...
San Jay's user avatar
  • 25
1 vote
2 answers
59 views

While loop input int validation

I’m having a problem with my code. my while loop 3 times when its meant to loop once i've tried everything i know and it's not working import java.util.Scanner; public class validInput { public ...
ennie Ayeni's user avatar
-2 votes
5 answers
281 views

sum up a numeric string (1111 = 1+1+1+1=4)

#Develop a program that reads a four-digit integer from the user and displays the sum of the digits in the number. For example, if the user enters 3141 then your program should display 3+1+4+1=9. ri =...
TahaAvadi's user avatar
-2 votes
1 answer
51 views

Using title() function for capitalizing printed sentence [closed]

I am looking a way to assign value to printed sentence to capitalize the first letters. The output should be: "Hello World!". This is my current code and the answer is "HELLO NEW WORLD&...
Tommy's user avatar
  • 3
0 votes
0 answers
79 views

Is IsNumeric the best way to check Dictionary Key if it is numeric

I have a small bit of code from a project that looks at options and prices of used cars. It contains a Dictionary of Dictionaries called "DictOfDictMakeModel". Several "For Each" ...
Astro Boy's user avatar
0 votes
1 answer
59 views

Using is_numeric to replace a string [closed]

In the course of converting some variables from an API, I need to check if the API is returning a string, such as " N/A", and not a number such as "824". This is the code that I'...
Steven Sheeley's user avatar
0 votes
1 answer
21 views

Test Average for an Arbitrary Amount of User Inputs

I have been working on a test average calculator where the user is supposed to enter any amount of test scores he wants and the number needs to be both an integer (the teacher wants us to use ...
Darcy Gott's user avatar
0 votes
2 answers
116 views

Why replace in this code approves float numbers as numeric . I have tried floats without replace and I am getting message that it is not a number

#user inputs a number number = input("Enter number: ") # 1) changes dot and creates a new string,2) verifies is it a number if(not number.replace(".","").isnumeric()): ...
Asterix's user avatar
  • 13
-2 votes
1 answer
90 views

Python program for soccer odds

match = input('Enter match? ') odd1 = input("Enter tip for home: ") if(not odd1.replace(".","").isnumeric()): print("Sorry home tip is not numeric") ...
Miki's user avatar
  • 33
0 votes
2 answers
73 views

Issues with floating numbers in for loop in PHP

I am trying to create a script that cleans a string from anything that is not a number or operator and then performs the calculation. It works fine if, for example, the sting is How much is 25 + 35 ...
lStoilov's user avatar
  • 1,246
0 votes
1 answer
35 views

Don't know what to use in this if-statement

isr = input() if (isr.isalpha() or (isr.isnumeric() and isr.isalpha())): print("You can't use a letter here.") else: isr = math.sqrt(float(isr)) print(isr) So i ...
Blogames's user avatar
1 vote
3 answers
625 views

Why does IsNumeric() return False when given a number from a text line

I am working on some python code that will evaluate each line of a file, and if that line is a number, it should return false and ignore that line. This code comes from https://github.com/geoff604/...
user3324136's user avatar
0 votes
1 answer
30 views

Reading and extracting useful data from a file with a loop fails to produce a list of values

I am reading a file with some data. I wish to divide the data into several categories and write these into files of their own (for example integers, like phone numbers; decimals; single words; and ...
Arthur's user avatar
  • 35
0 votes
1 answer
257 views

Using between clause on nvarchar column to find range is not working

I have 3 nvarchar columns user_3, user_4 and description. I am setting yes and no flag. If the value in description column is equal or in between user_3 and User4 then set the flag to 'N' else set the ...
James Smith's user avatar
0 votes
3 answers
1k views

java check if char is number in switch case statment [closed]

I have a switch case that checking if char is "=" or "-" or "+" but I like to check also if char is a number from 0-9 public static Token get(char ch) { ...
user63898's user avatar
  • 29.5k
0 votes
2 answers
170 views

How to find table column, then move down and replace the cell's content IF it is "N/A"

I have almost 1,800 Word documents that have about 8 pages with unique data in tables. We were just informed that the data we were given for some of those tables is inaccurate and needs to be changed ...
Brian's user avatar
  • 5
0 votes
1 answer
712 views

Extract all columns except numeric in R data frame [duplicate]

In my project, I want to extract all the columns except numeric from my R data frame, as this question I used the same method and just put a not gate into is.numeric() R function but it is not working ...
INDRAJITH EKANAYAKE's user avatar
1 vote
2 answers
2k views

Getting Error : 'int' object has no attribute 'isnumeric'

I was writing a code to get a student grade point average but I got an error. here is the piece of my code getting error : scoreinput=input("Score lesson: ") while True: if scoreinput....
QuicKiller's user avatar
0 votes
2 answers
549 views

Validated a Credit Card Number

Need some help with this, I pretty have it finished but I can't get it to display or work correctly. Using str_replace, it's suppose to take the actual credit card number and remove the - from it. I ...
Strife_x7x's user avatar
1 vote
2 answers
661 views

Why does is_numeric() return false when passed a seemingly numeric string?

I am trying to understand numeric strings in PHP. I have the following code: var_dump(5 * "10 abc"); var_dump(is_numeric("10 abc")); Which gives me the output: int(50) bool(false) ...
Bradley's user avatar
  • 327
0 votes
2 answers
779 views

why is isnumeric isdigit and isdecimal False for 1.5?

lst = ['a: 12', 'b: 1.5', 'c: 13'] for lines in lst: entry = lines.split(":") category = entry[0] amount = entry[1].strip() print(amount.isnumeric()) Result is True, False, ...
cccck's user avatar
  • 1
0 votes
1 answer
785 views

SELECT throwing an CAST error on a row that does not exist in query

I'm having a problem with a SELECT that is throwing a CAST error, but only when the CAST is in the WHERE clause. I've boiled the problem down to the below example SQL. CREATE TABLE dbo.CastTest ( [...
GSS's user avatar
  • 1
0 votes
1 answer
502 views

is there perfect way to check isset and is_numeric in 1 condition

I want to combine these two conditions in one in PHP. isset( $_GET['number'] ){ is_numeric( $_GET['number'] ){ /*----------------*/ } } I tried below code but it is showing error ...
MostlyFullStack's user avatar
0 votes
1 answer
343 views

Is there a way to use isnumber and search to pull from multiple cells and search multiple cells to return to multiple cells?

I have cobbled together the following formula, which works : =IF(ISNUMBER(SEARCH(F7, $B$11:$B$53)), $C$11:$C$53, IF(ISNUMBER(SEARCH(F8, $B$11:$B$53)), $C$11:$C$53, IF(ISNUMBER(...
RY_STEW's user avatar
0 votes
2 answers
46 views

Are there methods that should be downloaded into my python? [duplicate]

I entered this code on my text editor and it results in an error. So, do I need to download any kind of files for my Python edition in order to use this isnumeric method? txt = "565543" x = ...
Mohammed AL-Nashriy's user avatar
0 votes
0 answers
179 views

Input validation with IsNumeric does not work

I am trying to do an input validation (Only Accept Numeric Value), however the code below does not seem to work properly. Can someone please shed a light. Upon entering non-numerical Value, the ...
Pitbull999's user avatar
1 vote
2 answers
53 views

VB.Net Code comparision - which one is better and why?

it's my first post. Could you give me some tips which code is better and why? Mainly those two codes do the same, but using other methods. Cheers FIRST CODE Private Sub Button1_Click(sender As ...
WuWy's user avatar
  • 11
0 votes
3 answers
1k views

How do you get Excel VBA to recognize numeric cells?

I have a table of numbers that are all left aligned (i.e. Excel recognizes them as text) I run a VBA script on all cells: cell.value = cell.Value * 1 This right aligns all of them and Excel ...
Joka's user avatar
  • 55
0 votes
2 answers
2k views

Check for numeric value in text column - python

5 columns (col1 - col5) in a 10-column dataframe (df) should be either blank or have text values only. If any row in these 5 columns has an all numeric value, i need to trigger an error. Wrote the ...
SModi's user avatar
  • 125
3 votes
2 answers
622 views

How do I make IsNumeric check the whole string/variable instead of just the first character?

I am using IsNumeric to check if a part of a variable are numbers or not. Unfortunately it only seems to check the first character of the string part instead of the whole bit. It currently accepts i....
Davey's user avatar
  • 35
1 vote
1 answer
82 views

Excel Formula substitute similar values into a single formula

I have set up this formula, For each cell it should subtract the contents from what i have stored in data!$B$1, in this case this is 300, so if the contents of "Time 1" is 100, this will display 200, ...
TomRGarr's user avatar
0 votes
1 answer
2k views

How to check a string is numeric using Regex in SQL Server?

IsNumeric allows below special characters `SELECT ISNUMERIC('10.50') as '10.50' ISNUMERIC('10,50') as '10,50' ,ISNUMERIC('-') as '-' ,ISNUMERIC('+') as '+' ,ISNUMERIC('$') as '$' ,ISNUMERIC('.')...
Arjun Rathinasamy's user avatar
1 vote
2 answers
107 views

Using IsNumeric in a function

I wrote a function that generates a "score" (1,0,-1) based on a input cell, which should contain a number. However, sometimes the input field might not be numeric and then the function should return ...
yannk's user avatar
  • 51
1 vote
2 answers
496 views

Detect numeric year from string using Swift

I am looking for a way to detect years e.g. 2019. The requirements I think would be that the numbers are in a row, have four digits and are not adjacent to letters or special characters. So I'd like ...
user6631314's user avatar
  • 1,751
1 vote
2 answers
417 views

How can I skip non-numeric values when copy and paste using loop in VBA?

I would like to copy and paste a formula from column P to column C using a loop in VBA. The code should only copy and paste for numeric values in column P and do nothing when cell is blank. Sub ...
Robert's user avatar
  • 49
0 votes
0 answers
66 views

jQuery isNumeric issue

Trying to run the following jQuery script and although the passed value is certainly an integer it silently fails (no debug errors) at isNumeric. No alerts after this either (but the first one does ...
gchq's user avatar
  • 1,603
0 votes
1 answer
35 views

My error handlers return false when they shouldn't [duplicate]

I have the following error handlers in my PHP file: if (empty($title) || empty($description) || empty($price)) { header("Location: ../listing1.php?error=emptyfields"); exit(); } elseif (!...
user avatar
7 votes
5 answers
2k views

PHP "is_numeric" accepts "E" as a number

I noticed PHP is_numeric() accepts "E" as a number. I have a string: "88205052E00" and I want the result to be: NOT numeric. Here is the code which I tested. <?php $notnumber = '88205052E00'; ...
Cyborg's user avatar
  • 1,427
0 votes
1 answer
77 views

Check Moblie Number or Not in PHP String

Iam New in PHP . I Know How to Check a String number or Not using is_numeric but I want Check Mobile Number add + in my case $mobile = "+15666886345" ; if($mobile) { // Valid Mobile ...
safvan saf's user avatar
0 votes
1 answer
121 views

is_numeric and isEmail functions

I create field ($login), user should register with email or phone number So I want to o a security check to validate Can I use 2 functions at same time ? I tried the following code but it didn't ...
Dr.Mezo's user avatar
  • 777
1 vote
3 answers
176 views

Taking sum of all lines containing number and skipping those with alphabets and write back the sum to another file

I have written the following code which reads a file that contains lines with numbers and alphabets I want to calculate sum of all numbers in a single line and skip the lines with alphabets and ...
Mudassir Awan's user avatar
-2 votes
1 answer
29 views

check occurance of an integer in a string without using any built in php methods

function findIntInStr($str=''){ $str = 'abc123'; for($i=0;!empty($str[$i]);$i++) { if(is_numeric($str[$i])) { return false; } } return true; } This ...
imrahul's user avatar
  • 41
0 votes
4 answers
928 views

IsNumeric and Case-when to count numeric values and change how it's displayed in results

I'm trying to pull counts from a survey customers answer over the phone. The survey has 3 questions and the answers are sometimes numeric and sometimes words. I want to count the answers but need the ...
MTG5280_'s user avatar
0 votes
1 answer
87 views

How to use IsNumeric on Index Match?

I'm strugling to get my code to work. When trying to evaluate if the value found by my Index(Match()) is a number with IsNumeric I get a "Mismatch Error 13" once every other time. When I don't get the ...
plank's user avatar
  • 13
0 votes
0 answers
66 views

Authentication / Client Validation / How to check if input is a number?

[Required(ErrorMessage = "You need to add your phone number")] public string PhoneNumber { get; set; } I want to allow numbers only and display error message if it's not a number. I also want to ...
Jack Peeterson's user avatar
0 votes
2 answers
38 views

SQL Server 2014 - How to select rows with no numerical values in fields?

I'm trying to find Accounts that have nothing in the phone number field and nothing in the EmailAddress field. But when I use the ISNUMERIC function to filter our records with a phone number, I still ...
user1777929's user avatar
3 votes
2 answers
119 views

Delete Column Rows with Any Numeric Substrings

I notice that when an element of a column from a Pandas DataFrame has numeric substrings, the method isnumeric returns false. For example: row 1, column 1 has the following: 0002 0003 1289 row 2, ...
spacedustpi's user avatar
1 vote
3 answers
644 views

Using IsNumeric to delete rows of data

I have two columns of data I am cleaning up using VBA. If the value in column A is non-numeric or blank, I need to delete the entire row. Below is a sample of the data and the code I am trying to ...
Koda's user avatar
  • 153