package com.example.springip.lab2.domains;

import com.example.springip.lab2.domains.OperationInterface;
import org.springframework.stereotype.Component;

@Component(value = "str")
public class OperationStringImpl implements OperationInterface<String> {
    @Override
    public String sum(String o, String o2) {
        return o+o2;
    }

    @Override
    public String mul(String o, int num) {
        StringBuilder res = new StringBuilder();
        for (int i = 0; i < num; i++) {
            res.append(o);
        }
        return res.toString();
    }

    @Override
    public int length(String o) {
        return o.length();
    }

    @Override
    public boolean startsWith(String o, String symb) {
        return o.startsWith(symb);
    }
}
