From 583983e58f7416fae0e93e63f1bec2ee27e0b656 Mon Sep 17 00:00:00 2001 From: torrentcome Date: Tue, 16 May 2017 10:40:12 +0200 Subject: [PATCH] (string utils) create string utils for start to group all function there --- .../keylesspalace/tusky/util/StringUtils.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 app/src/main/java/com/keylesspalace/tusky/util/StringUtils.java diff --git a/app/src/main/java/com/keylesspalace/tusky/util/StringUtils.java b/app/src/main/java/com/keylesspalace/tusky/util/StringUtils.java new file mode 100644 index 000000000..ff050f2c7 --- /dev/null +++ b/app/src/main/java/com/keylesspalace/tusky/util/StringUtils.java @@ -0,0 +1,19 @@ +package com.keylesspalace.tusky.util; + +import java.util.Random; + +public class StringUtils { + + public final static String carriageReturn = System.getProperty("line.separator"); + final static String QUOTE = "\""; + + public static String randomAlphanumericString(int count) { + char[] chars = new char[count]; + Random random = new Random(); + final String POSSIBLE_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + for (int i = 0; i < count; i++) { + chars[i] = POSSIBLE_CHARS.charAt(random.nextInt(POSSIBLE_CHARS.length())); + } + return new String(chars); + } +}