This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val reader: java.io.InputStreamReader = | |
/*new*/ java.io.File(filename).reader() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val reader = File(filename).reader() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package wscrambler | |
import java.io.File | |
// 4+ Latin letters, 2+ distinct inners | |
private val WORD_REGEX = | |
"""\p{IsLatin}(\p{IsLatin})\1*(?!\1)\p{IsLatin}\p{IsLatin}+""" | |
.toRegex() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WordScrambler { | |
// 4+ letters, 2+ distinct inners | |
// \p{IsLatin} equals [a-zA-ZÀ-ÿ] | |
// Range [À-ÿ]: accented letters | |
private static final Pattern WORD_REGEX = | |
Pattern.compile("\\p{IsLatin}(\\p{IsLatin})\\1*(?!\\1)\\p{IsLatin}\\p{IsLatin}+"); | |
// Scramble words within text |
NewerOlder