<commit_before><commit_msg>added processor for string replacement<commit_after>package org.supercsv.cellprocessor;

import org.supercsv.cellprocessor.ift.StringCellProcessor;
import org.supercsv.exception.SuperCSVException;
import org.supercsv.util.CSVContext;

public class StrReplace extends CellProcessorAdaptor {
private String searchText, replaceText;

public StrReplace(String searchText, String replaceText) {
	super();
	handleArguments(searchText, replaceText);
}

public StrReplace(String searchText, String replaceText, StringCellProcessor next) {
	super(next);
	handleArguments(searchText, replaceText);
}

/**
 * {@inheritDoc}
 */
@Override
public Object execute(final Object value, final CSVContext context) throws SuperCSVException {
	return value.toString().replaceAll(searchText, replaceText);
}

private void handleArguments(String searchText, String replaceText) throws IllegalArgumentException {
	if( searchText == null ) { throw new SuperCSVException("argument searchText cannot be null"); }
	if( replaceText == null ) { throw new SuperCSVException("argument replaceText cannot be null"); }
	if( searchText.equals("") ) { throw new SuperCSVException(
		"argument searchText cannot be \"\" as this has no effect"); }
	this.searchText = searchText;
	this.replaceText = replaceText;
}
}
{'fraction_non_alphanumeric': 0.09593246354566386, 'fraction_numerical': 0.0, 'mean_word_length': 6.761904761904762, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3305642', 'n_tokens_mistral': 349, 'n_tokens_neox': 346, 'n_words': 103}