<commit_before>/*
 * Copyright (c) 2019 toastkidjp.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompany this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html.
 */
package jp.toastkid.yobidashi.editor

import android.widget.EditText

/**
 * @author toastkidjp
 */
class StringSurroundingUseCase {

    operator fun invoke(editText: EditText, character: Char) {
        val selectionStart = editText.selectionStart
        val selectionEnd = editText.selectionEnd
        val text = editText.text.substring(selectionStart, selectionEnd)

        editText.text.replace(
                selectionStart,
                selectionEnd,
                "$character$text$character"
        )
    }
}<commit_msg>feature #511 Enable to accept any type surroundings.<commit_after>/*
 * Copyright (c) 2019 toastkidjp.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompany this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html.
 */
package jp.toastkid.yobidashi.editor

import android.widget.EditText

/**
 * @author toastkidjp
 */
class StringSurroundingUseCase {

    operator fun invoke(editText: EditText, surrounding: Any) {
        val selectionStart = editText.selectionStart
        val selectionEnd = editText.selectionEnd
        val text = editText.text.substring(selectionStart, selectionEnd)

        editText.text.replace(
                selectionStart,
                selectionEnd,
                "$surrounding$text$surrounding"
        )
    }
}
{'fraction_non_alphanumeric': 0.08022598870056497, 'fraction_numerical': 0.010734463276836158, 'mean_word_length': 2.979775280898876, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7251856', 'n_tokens_mistral': 495, 'n_tokens_neox': 459, 'n_words': 139}