All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.pfabulist.loracle.license.Splitter Maven / Gradle / Ivy

Go to download

maven plugin to check the licenses of all dependencies and possible incompatibilities

There is a newer version: 2.0.1
Show newest version
package de.pfabulist.loracle.license;


import de.pfabulist.roast.collection.P;

import java.util.ArrayList;
import java.util.List;

/**
 * Copyright (c) 2006 - 2016, Stephan Pfab
 * SPDX-License-Identifier: BSD-2-Clause
 */

public class Splitter {

    public static List> cutMiddle( String str, int from, int to, MappedLicense l) {
        List> res = new ArrayList<>();
        if( from > 0 ) {
            res.add( P.of( str.substring( 0, from ), MappedLicense.empty() ));
        }

        res.add( P.of( str.substring( from, to ), l ));

        if( from < str.length() ) {
            String sub = str.substring( to, str.length() );
            if ( !sub.trim().isEmpty()) {
                res.add( P.of( sub, MappedLicense.empty() ) );
            }
        }
        return res;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy