• Intro Headers Instructions Macros Commands
Fork me on GitHub
    • Introduction
    • How to install bnd
    • Guided Tour
    • Guided Tour Workspace & Projects
    • Concepts
    • Best practices
    • Build
    • Project Setup
    • Generating JARs
    • Versioning
    • Baselining
    • Service Components
    • Metatype
    • Contracts
    • Bundle Annotations
    • Accessor Properties
    • SPI Annotations
    • Resolving Dependencies
    • Launching
    • Startlevels
    • Testing
    • Testing with Launchpad
    • Packaging Applications
    • JPMS Libraries
    • Wrapping Libraries to OSGi Bundles
    • Generating Documentation
    • Commands
    • For Developers
    • Tips for Windows users
    • Tools bound to bnd
    • Reference
    • Headers
    • Instruction Reference
    • Instruction Index
    • Macro Reference
    • Macro Index
    • Plugins
    • External Plugins
    • Settings
    • Errors
    • Warnings
    • Frequently Asked Questions
  • sublist ';' START ';' END (';' LIST )*
    Macro

    static String	_sublist	= "${sublist;<start>;<end>;<list>}";
    
    public String _sublist(String args[]) throws Exception {
    	verifyCommand(args, _sublist, null, 4, Integer.MAX_VALUE);
    
    	int start = Integer.parseInt(args[1]);
    	int end = Integer.parseInt(args[2]);
    	ExtList<String> list = toList(args, 3, Integer.MAX_VALUE);
    
    	if (start < 0)
    		start = list.size() + start + 1;
    
    	if (end < 0)
    		end = list.size() + end + 1;
    
    	if (start > end) {
    		int t = start;
    		start = end;
    		end = t;
    	}
    
    	return Processor.join(list.subList(start, end));
    }
    
    • GitHub