tinyscalautils.text
Members list
Type members
Classlikes
All caps letters as single characters.
All caps letters as single characters.
Attributes
- Source
- Letters.scala
- Supertypes
- Self type
-
CharLetters.type
Printing mode. Decides which of thread/time is shown and how.
Printing mode. Decides which of thread/time is shown and how.
For instance,
printf("(%d,%d)%n", x, y)
might produce output of the form: T1 at 09:15:49.525: (2,3)
where T1
is the name of the thread that called printf
.
Actual format is controlled by a printing mode. For instance:
import tinyscalautils.printing.{ println, threadTimeMode }
println("message")
might produce main at 17:29:50.623: message
, while:
import tinyscalautils.printing.{ println, threadMode }
println("message")
All printing modes in this package are stateless and thus safe to be shared among threads.
Attributes
- Since
-
1.0
- Source
- PrintingMode.scala
- Supertypes
- Known subtypes
-
object silentModeobject standardModeobject threadModeobject threadTimeDemoModeobject threadTimeModeobject timeDemoModeobject timeModeShow all
All caps letters as single character strings.
All caps letters as single character strings.
Attributes
- Source
- Letters.scala
- Supertypes
- Self type
-
StringLetters.type
Silent. Does not print anything. No call to Predef.printf/println
takes place.
Silent. Does not print anything. No call to Predef.printf/println
takes place.
Attributes
- Source
- PrintingMode.scala
- Supertypes
- Self type
-
silentMode.type
Standard printing. Equivalent to Predef.printf/println
.
Standard printing. Equivalent to Predef.printf/println
.
Attributes
- Source
- PrintingMode.scala
- Supertypes
- Self type
-
standardMode.type
Adds thread name. Strings are printed as: <thread>: <string>
.
Adds thread name. Strings are printed as: <thread>: <string>
.
Attributes
- Source
- PrintingMode.scala
- Supertypes
- Self type
-
threadMode.type
Adds thread name and time, but hides hours and minutes. Strings are printed as: <thread> at XX:XX:SS.millis: <string>
Adds thread name and time, but hides hours and minutes. Strings are printed as: <thread> at XX:XX:SS.millis: <string>
Attributes
- Source
- PrintingMode.scala
- Supertypes
- Self type
-
threadTimeDemoMode.type
Adds thread name and time. Strings are printed as: <thread> at HH:MM:SS.millis: <string>
Adds thread name and time. Strings are printed as: <thread> at HH:MM:SS.millis: <string>
Attributes
- Source
- PrintingMode.scala
- Supertypes
- Self type
-
threadTimeMode.type
Adds time, but hides hours and minutes. Strings are printed as: at XX:XX:SS.millis: <string>
Adds time, but hides hours and minutes. Strings are printed as: at XX:XX:SS.millis: <string>
Attributes
- Source
- PrintingMode.scala
- Supertypes
- Self type
-
timeDemoMode.type
Adds time. Strings are printed as: at HH:MM:SS.millis: <string>
Adds time. Strings are printed as: at HH:MM:SS.millis: <string>
Attributes
- Source
- PrintingMode.scala
- Supertypes
- Self type
-
timeMode.type
Value members
Concrete methods
Returns its input and prints a single dot, according to the given printing mode. The only possible modes are standardMode
(by default) and silentMode
.
Returns its input and prints a single dot, according to the given printing mode. The only possible modes are standardMode
(by default) and silentMode
.
Attributes
- Source
- Dot.scala
Prints basic runtime info.
Prints basic runtime info.
Attributes
- Throws
-
IllegalArgumentException
if
newLines
is negative. - Source
- info.scala
Returns the singular form when x
is less or equal to 1 and the plural form otherwise.
Returns the singular form when x
is less or equal to 1 and the plural form otherwise.
Attributes
- Since
-
1.1
- Source
- plural.scala
A variant of plural
that guesses the plural form (e.g., cat -> cats, DOG -> DOGS, platypus -> platypuses).
A variant of plural
that guesses the plural form (e.g., cat -> cats, DOG -> DOGS, platypus -> platypuses).
Attributes
- Since
-
1.1
- Source
- plural.scala
Formatted printing.
Formatted printing with a format.
Formatted printing with a newline.
Captures the output of print statements into a string.
Captures the output of print statements into a string.
This captures Console.out
. Console.err
is let through by default, but can be included in the capture by setting includeErr
to true. Also left out are System.out
and System.err
, for which there is also an option, includeSystem
. Both options can be combined for four possible combinations. (It is not possible to capture System.out/err
without capturing Console.out/err
.)
The mechanism used to capture Console.out/err
is thread-safe. In particular, different threads can capture independently. System.out/err
, on the other hand, are global variables.
To capture the output of new threads, it is essential that these threads are created within the printout
function:
val str = printout:
val exec = Executors.newThreadPool(n)
exec.execute(...)
Attributes
- See also
- Since
-
1.0
- Source
- printout.scala
Captures the output of print statements into a string.
Captures the output of print statements into a string.
This is the short form of printout
that uses default values.
Attributes
- Since
-
1.0
- Source
- printout.scala
Returns its input and prints a single star, according to the given printing mode. The only possible modes are standardMode
(by default) and silentMode
.
Returns its input and prints a single star, according to the given printing mode. The only possible modes are standardMode
(by default) and silentMode
.
Attributes
- Source
- Dot.scala
Human-friendly representation of a duration, using days, hours, minutes, seconds and milliseconds.
Human-friendly representation of a duration, using days, hours, minutes, seconds and milliseconds.
Value parameters
- unitsCount
-
the number of different units used in the representation, between 1 and 5. Using 2 units (the defaults) results in strings of the form
3 minutes, 20 milliseconds
or1 hour, 10 seconds
.
Attributes
- Throws
-
IllegalArgumentException
if the duration is negative, the number of units is less than 1, or the duration exceeds 2147483647 days.
- Since
-
1.1
- Source
- timeString.scala
Givens
Givens
Silent. Does not print anything. No call to Predef.printf/println
takes place.
Silent. Does not print anything. No call to Predef.printf/println
takes place.
Attributes
- Source
- PrintingMode.scala
Standard printing. Equivalent to Predef.printf/println
.
Adds thread name. Strings are printed as: <thread>: <string>
.
Adds thread name and time, but hides hours and minutes. Strings are printed as: <thread> at XX:XX:SS.millis: <string>
Adds thread name and time, but hides hours and minutes. Strings are printed as: <thread> at XX:XX:SS.millis: <string>
Attributes
- Source
- PrintingMode.scala
Adds thread name and time. Strings are printed as: <thread> at HH:MM:SS.millis: <string>
Adds thread name and time. Strings are printed as: <thread> at HH:MM:SS.millis: <string>
Attributes
- Source
- PrintingMode.scala
Adds time, but hides hours and minutes. Strings are printed as: at XX:XX:SS.millis: <string>
Adds time, but hides hours and minutes. Strings are printed as: at XX:XX:SS.millis: <string>
Attributes
- Source
- PrintingMode.scala
Adds time. Strings are printed as: at HH:MM:SS.millis: <string>
Adds time. Strings are printed as: at HH:MM:SS.millis: <string>
Attributes
- Source
- PrintingMode.scala
Extensions
Extensions
String with all CRLF replaces with LF.
Pads a string to a given length.
Pads a string to a given length.
Contrary to padTo
, this is a pad on the left.
Value parameters
- minLen
-
the guatanteed minimum length of the string being returned.
- padding
-
the character used to pad.
Attributes
- Throws
-
IllegalArgumentException
if
minLen
is negative. - Since
-
1.0
- Source
- stringExtensions.scala
Truncates a string to 32 characters.
Truncates a string to a given length.
Truncates a string to a given length.
Value parameters
- maxLen
-
the guaranteed maximum length of the string being returned.
Attributes
- Throws
-
IllegalArgumentException
if
maxLen
is less than 3. - Since
-
1.0
- Source
- stringExtensions.scala