Determine if a string is numeric
![Task](http://static.miraheze.org/rosettacodewiki/thumb/b/ba/Rcode-button-task-crushed.png/64px-Rcode-button-task-crushed.png)
You are encouraged to solve this task according to the task description, using any language you may know.
Demonstrates how to implement a custom IsNumeric method in other .NET/Mono languages that do not wish to reference the Microsoft.VisualBasic.dll assembly.
VB.NET
Compiler: Microsoft (R) Visual Basic Compiler version 8.0
Dim Value As String = "123" If IsNumeric(Value) Then End If
C#
Compiler: Microsoft (R) Visual C# 2005 Compiler version 8.00
public static bool IsNumeric(string value) { value = value.Trim(); if (value == string.Empty) return false; if (char.IsSymbol(value[0]) == false && char.IsNumber(value[0]) == false) return false; if (char.IsSymbol(value[0]) && value.Length > 1 && char.IsNumber(value[1]) == false) return false; return true; } string Value = "123"; If (IsNumeric(Value)) { }
PHP
$string = '123'; if(is_numeric($string)) { }