public class BotUtils
extends java.lang.Object
Constructor and Description |
---|
BotUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getCostString(double d)
Formats the specified number like you would expect for a dollar amount.
|
static java.lang.String |
getDateStringFromJUTC(long dateLoanGivenJUTC)
Gets a date string from a timestamp that was acquired as if by
System.currentTimeMillis |
static java.lang.String |
getDollarAmountPatternString()
Get the string to use to search for a dollar amount.
|
static int |
getPennies(java.lang.String number)
Parses the number as a double, multiplies by a hundred, and rounds to an
int.
|
static java.lang.String |
getUser(java.lang.String str)
From a string that contains a username, strips (if it exists) the /u/ and
sets to lowercase.
|
static int |
parseDollarAmount(java.lang.String string)
Parses the group returned from
getDollarAmountPatternString() |
public static java.lang.String getDollarAmountPatternString()
public static int parseDollarAmount(java.lang.String string) throws java.lang.NumberFormatException
getDollarAmountPatternString()
string
- the groupjava.lang.NumberFormatException
- if the quantity is not a valid dollar amountpublic static java.lang.String getCostString(double d)
d
- the amount in dollarspublic static java.lang.String getDateStringFromJUTC(long dateLoanGivenJUTC)
System.currentTimeMillis
dateLoanGivenJUTC
- when the loan was givenpublic static java.lang.String getUser(java.lang.String str)
str
- the username string to parsepublic static int getPennies(java.lang.String number) throws java.text.ParseException
number
- the number string to parsejava.text.ParseException
- if it's not a valid number