• Intro Headers Instructions Macros Commands
Fork me on GitHub
    • Getting Started
      • Introduction
      • How to install bnd
      • Guided Tour Workspace & Projects
      • bnd / bndlib Features and JAR Wrapping Techniques
      • FAQ - Frequently Asked Questions
    • Concepts and Practices
      • Concepts
      • Background
      • Best practices
    • Build and Development
      • Build
      • Generating JARs
      • Versioning
      • Baselining
      • Service Components
      • Metatype
      • Contracts
      • Bundle Annotations
      • Accessor Properties
      • SPI Annotations
    • Dependency and Launching
      • Resolving Dependencies
      • Launching
      • Startlevels
    • Testing
      • Testing
      • Testing with Launchpad
    • Packaging and Distribution
      • Packaging Applications
      • JPMS Libraries
      • Wrapping Libraries to OSGi Bundles
    • Documentation and Tools
      • Generating Documentation
      • bnd CLI Commands
      • For Developers
      • Templates for Workspaces
      • Tips for Windows users
      • Tools bound to bnd
    • Reference Material
      • Reference
      • Headers
      • Instruction Reference
      • Instruction Index
      • Macro Reference
      • Macro Index
      • Plugins
      • External Plugins
    • Configuration and Troubleshooting
      • Settings
      • Errors
      • Warnings
  • isnumber ( ';' STRING )*

    Prev Next
    Macro
    Check if all given strings are valid numbers

    Summary

    The isnumber macro checks if all provided arguments are valid numeric values. Returns true only if all arguments are numbers, false otherwise.

    Syntax

    ${isnumber;<string>[;<string>...]}
    

    Parameters

    • string - One or more strings to check (minimum 1 required)

    Behavior

    • Returns true if all arguments are valid numbers
    • Returns false if any argument is not numeric
    • Accepts integers and decimals
    • Scientific notation supported
    • Requires at least one argument

    Examples

    Check if numeric:

    ${if;${isnumber;${value}};is-numeric;not-numeric}
    

    Validate multiple values:

    ${isnumber;123;45.6;-78}
    # Returns: true
    

    Not a number:

    ${isnumber;abc}
    # Returns: false
    

    Mixed values:

    ${isnumber;123;abc}
    # Returns: false (all must be numeric)
    

    Use Cases

    • Input validation
    • Type checking
    • Numeric validation before operations
    • Configuration validation
    • Data type verification

    Notes

    • All arguments must be numeric for true
    • Supports integers, decimals, negative
    • Scientific notation accepted
    • Requires at least one argument
    • Returns boolean
    • See also: ${matches} for pattern matching

    See test cases in MacroTestsForDocsExamples.java

Prev Next
Search
    • Home