IsNumeric() method works for only Integer value not for decimal value

like this

String str = '10';
system.debug('===strToDec=='+str.isNumeric());

This will return true.


String str = '10.25';

Decimal strToDec = decimal.valueOf(str);

system.debug('===strToDec=='+strToDec);

String decToStr = String.valueOf(strToDec);

system.debug('===decToStr=='+decToStr);

Run this code in developer console ad check output.


In you case do something like. First convert string to numeric then check and again convert string into decimal for future use

String  str = '10.25';
Integer intCheck = Integer.ValueOf(str);
Decimal decVal = Decimal.ValueOf(str);
if(String.ValueOf(intCheck ).isNumeric())
//use decVal here

Don't understand why you need this.

Answer from Ratan Paul on Stack Exchange
🌐
Concretio
concret.io › blog › using-decimal-class-with-strings-in-apex
Tip: Using Decimal class with Strings in Apex
December 1, 2025 - But it's Double class that is used in the v16 API, which has been upgraded to the Decimal class in later versions for more precision. So, to again get back to the same Double in Apex, we can change the code as shown below: Mock__c mock = [Select Counter__c from Mock__c where Name = 'Demo']; Double dblValue = mock.Counter__c .doubleValue(); String url = 'http://mycooldomain.com/'+ dblValue; System.debug ('Generated URL :' + url); Instead of directly appending any queried number field to the String, try storing it as a specific Type(Decimal) in a local variable.
🌐
S2 Labs
s2-labs.com › home › what is the rule of conversions in apex?
Rules of Conversion in Apex - S2 Labs training
In general, apex requires explicit conversion from one datatype to another; however, a few datatypes can be implicitly converted, such as variables of lower numeric type to higher types. For example, a variable of the Integer data type cannot be implicitly converted to a String.
Published   August 6, 2025
🌐
Blogger
salesforcesource.blogspot.com › 2008 › 11 › utility-apex-class-to-convert-all-types.html
Salesforce : A Utility Apex Class to Convert All Types Into String
ToString(Decimal, ScientificNotaion) ScientificNotaion is a Boolean value and if false is passed then the string will not have scientific notations.
🌐
Stack Overflow
stackoverflow.com › questions › 40676675 › convert-number-to-words-in-apex-salesforce
class - Convert Number to Words in apex salesforce - Stack Overflow
Below apex code can be used to convert number (currency) into words. This code can be used in triggers,visualforce pages to convert any number/currency field value in words and stored in any text field.
Find elsewhere
🌐
Regardie
regardie.dev › post-3264
Apexのデータ型変換まとめ【Salesforce】 – Regardie's Salesforce Blog
Decimal → String · String convertedStr = String.valurOf(decimal); String → Decimal · Decimal convertedDec = decimal.valueOf(str); Decimal → Integer · Integer convertedInt = Integer.valueOf(decimal) Integer → Decimal · Decimal convertedDec = decimal.valueOf(int); Date → String ·
🌐
Salesforce
trailhead.salesforce.com › trailblazer-community › feed › 0D54S00000A8435SAB
converting string to decimal in wrapper class - Trailhead
Skip to main content · Register now for TDX! Join the must-attend event to experience what’s next and learn how to build it
🌐
Salesforcefaqs
salesforcefaqs.com › home › convert a string to decimal in salesforce apex
Convert a String to Decimal in Salesforce Apex
August 26, 2025 - In this Salesforce tutorial, I will explain how to convert a string to a decimal in Salesforce Apex.
🌐
Oracle
docs.oracle.com › en › database › oracle › apex › 24.2 › aexjs › apex.locale.html
apex.locale - JSDoc: Namespace
January 14, 2025 - The apex.locale namespace contains ... to a specific locale. For localizing text messages see apex.lang. ... Formats the given number in a compact, locale specific way. For example in the US English locale the number 123400 would be formatted as "123.4K" and 1234000 as "1.23M".
🌐
Greytrix
greytrix.com › blogs › salesforce › tag › convert-the-string-into-a-decimal-or-number
convert the string into a decimal or number Archives - Salesforce.com-Tips and Tricks
One common issue when integrating SF to any system is the “Illegal Assignment from String to Decimal” error, which occurs when string data from the other system is assigned to a numeric field in Salesforce. Integrating data between Salesforce and ERP (or any other system) can be complex, ...
🌐
Stack Overflow
stackoverflow.com › questions › 47873137 › apex-5-1-4-convert-number-to-decimal
Apex 5.1.4 Convert Number to Decimal - Stack Overflow
oracle-apex · See similar questions with these tags. The Overflow Blog · To write secure code, be less gullible than your AI · The AI ick · Featured on Meta · We’re releasing our proactive anti-spam measure network-wide · Results of the October 2025 Community Asks Sprint: copy button for code... Opinion-based questions alpha experiment on Stack Overflow · 8 SQL How to convert a decimal to a string ·
🌐
YouTube
youtube.com › roel van de paar
Salesforce: How do I convert a String to Decimal in Apex using a specific locale? - YouTube
Salesforce: How do I convert a String to Decimal in Apex using a specific locale?Helpful? Please support me on Patreon: https://www.patreon.com/roelvandepaa...
Published   January 4, 2021
Views   136
🌐
Greytrix
greytrix.com › blogs › salesforce › 2024 › 10 › 22 › how-to-fix-the-error-illegal-assignment-from-string-to-decimal-while-importing-data-from-sage-to-salesforce
How to fix the error "Illegal Assignment from String to Decimal" while importing data from Sage to Salesforce - Salesforce.com-Tips and Tricks
October 22, 2024 - The easiest solution to the error “Illegal Assignment from String to Decimal” is to change the data type of the problematic Salesforce field from Number to String. This allows Salesforce to accept the incoming data without conversion errors.
🌐
Beyondthecloud
blog.beyondthecloud.dev › blog › type-casting-in-apex
Type Casting in Apex | Beyond The Cloud
February 27, 2025 - Blob myBlob = Blob.valueof('StringToBlob'); Object myBlobResult = myBlob; Boolean myBoolean = true; Object myBooleanResult = myBoolean; Date myDate = Date.today(); Object myDateResult = myDate; DateTime myDateTime = DateTime.now(); Object myDateTimeResult = myDateTime; Decimal myDecimal = 1.1; Object myDecimalResult = myDecimal; Double myDouble = 1261992; Object myDoubleResult = myDouble; Id myId = '1035U00000ckdinQAX'; Object myIdResult = myId; Integer myInteger = 12345; Object myIntegerResult = myInteger; Long myLong = 4271990; Object myLongResult = myLong; String myString = 'myString'; Object myStringResult = myString; Account account = new Account(); Object myAccountResult = account;