Name: Anonymous 2009-01-17 9:43
is there such a thing???? i am sort of a n00b at all this BBCODE shit! is it even possible????
package fourchan.bbcode;
import java.util.Random;
public class BBshitter {
private static final int TEXT_LEN = 512;
private static final String tag = "sub";
private final String open = "[" + tag + "]";
private final String close = "[/" + tag + "]";
private String str;
private double pushFactor = 0.6;
public BBshitter(String s) {
this.str = s;
}
private void run() {
char[] arr = str.toCharArray();
boolean flag = false;
int depth = 0;
StringBuilder result = new StringBuilder();
for (char c : arr) {
if (Math.random() < pushFactor) { /*push*/
depth++;
result.append(open);
flag = true;
} else if (flag) { /*pop*/
if (--depth < 0)
depth = 0;
result.append(close);
}
result.append(c);
}
for (; depth>0; depth--, result.append(close));
System.out.println(result);
}
private static String getText() {
Random r = new Random();
final char[] lang = new String("ѠѫҨ֑֓۞ڮݚᴂۿᴟᴞ▐☻☼♥♯⌐↨⅞‡†⁞◘◙┬╔⌂").toCharArray();
StringBuilder text = new StringBuilder();
for(int i=0; i<TEXT_LEN; i++)
text.append(lang[r.nextInt(lang.length)]);
return text.toString();
}
public static void main(String[] args) {
new BBshitter(getText()).run();
}
}