Package com.anylogic.engine
- All Known Implementing Classes:
Agent
,Experiment
,ExperimentCompareRuns
,ExperimentMultipleRuns
,ExperimentOptimization
,ExperimentParamVariation
,ExperimentRunFast
,ExperimentSimulation
,FlowchartBlock
,Utilities
public interface UtilitiesString
Various string utilities, e.g. number formatting.
- Author:
- AnyLogic North America, LLC https://anylogic.com
Modifier and Type | Method | Description |
---|---|---|
static String | format |
Formats a boolean value
|
static String | format |
Formats a character to
String |
static String | format |
Formats a double value using the default AnyLogic formatter
|
static String | format |
Formats a double value with units, using the default AnyLogic formatter
|
static String | format |
Formats an integer value using the default AnyLogic formatter
|
static String | format |
Formats a long value using the default AnyLogic formatter
|
static String | format |
Formats a date using the default AnyLogic formatter
|
static String | formatAmountUnits |
Converts value to required units and turns it into String
|
static String | formatDayOfWeek |
Returns the full or short name of the weekday
|
static String | formatFlowRateUnits |
Converts value to required units and turns it into String
|
static String | formatLengthUnits |
Converts value to required units and turns it into String
|
static String | formatLengthUnits |
Returns the full or short name of the length units
|
static String | formatMonth |
Returns the full or short name of the month
|
static String | formatSpeedUnits |
Converts value to required units and turns it into String
|
static int | parseInt |
This method is internal and shouldn't be called by user.
it may be removed/renamed in future. Inverse operation of format(int) |
static String format(double value)
Formats a double value using the default AnyLogic formatter
- Parameters:
value
- the double value to be formatted.- Returns:
- the string containing the formatted value
static String format(double value, IUnits<?> units)
Formats a double value with units, using the default AnyLogic formatter
- Parameters:
value
- the double value to be formatted.units
- units- Returns:
- the string containing the formatted value
- Since:
- 8.0
static String format(int value)
Formats an integer value using the default AnyLogic formatter
- Parameters:
value
- the integer value to be formatted.- Returns:
- the string containing the formatted value
static String format(long value)
Formats a long value using the default AnyLogic formatter
- Parameters:
value
- the long value to be formatted.- Returns:
- the string containing the formatted value
@AnyLogicInternalAPI static int parseInt(String text) throws ParseException
This method is internal and shouldn't be called by user.
it may be removed/renamed in future.
Inverse operation of
it may be removed/renamed in future.
Inverse operation of
format(int)
- Throws:
ParseException
static String format(Date date)
Formats a date using the default AnyLogic formatter
- Parameters:
date
- the date to be formatted.- Returns:
- the string containing the formatted value
static String formatDayOfWeek(int dayOfWeek, boolean fullName)
Returns the full or short name of the weekday
- Parameters:
dayOfWeek
- one of#MONDAY
,#TUESDAY
, ... constantsfullName
- iftrue
, then returns the full name ("Monday", "Tuesday", etc.), otherwise - short ("Mon", "Tue", etc.)- Returns:
- the name of the weekday
static String formatMonth(int month, boolean fullName)
Returns the full or short name of the month
- Parameters:
month
- one of#JANUARY
,#FEBRUARY
, ... constantsfullName
- iftrue
, then returns the full name ("January", "February", etc.), otherwise - short ("Jan", "Feb", etc.)- Returns:
- the name of the month
static String formatLengthUnits(LengthUnits unit, boolean fullName)
Returns the full or short name of the length units
- Parameters:
unit
- length unitsfullName
- iftrue
, then returns the full name ("meter", "foot", etc.), otherwise - short ("m", "ft", etc.)- Returns:
- the name of the units
static String formatAmountUnits(double value, AmountUnits units)
Converts value to required units and turns it into String
- Parameters:
value
- value in cubic meters or kilogramsunits
- required units- Returns:
- string representation
static String formatFlowRateUnits(double value, FlowRateUnits units)
Converts value to required units and turns it into String
- Parameters:
value
- value in cubic meters per second or kilograms per secondunits
- required units- Returns:
- string representation
static String formatLengthUnits(double value, LengthUnits units)
Converts value to required units and turns it into String
- Parameters:
value
- value in metersunits
- required units- Returns:
- string representation
static String formatSpeedUnits(double value, SpeedUnits units)
Converts value to required units and turns it into String
- Parameters:
value
- value in meters per secondunits
- required units- Returns:
- string representation
static String format(boolean value)
Formats a boolean value
- Parameters:
value
- the boolean value to be formatted.- Returns:
- the string containing the formatted value ("true" or "false")
static String format(char value)
Formats a character to
String
- Parameters:
value
- the character value to be formatted.- Returns:
- the string containing the formatted value