tinyscalautils.text

Members list

Type members

Classlikes

object CharLetters

All caps letters as single characters.

All caps letters as single characters.

Attributes

Source
Letters.scala
Supertypes
class Object
trait Matchable
class Any
Self type
trait PrintingMode

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
class Object
trait Matchable
class Any
Known subtypes
object silentMode
object standardMode
object threadMode
object timeDemoMode
object timeMode
Show all
object StringLetters

All caps letters as single character strings.

All caps letters as single character strings.

Attributes

Source
Letters.scala
Supertypes
class Object
trait Matchable
class Any
Self type
object silentMode extends PrintingMode

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
trait PrintingMode
class Object
trait Matchable
class Any
Self type
silentMode.type
object standardMode extends PrintingMode

Standard printing. Equivalent to Predef.printf/println.

Standard printing. Equivalent to Predef.printf/println.

Attributes

Source
PrintingMode.scala
Supertypes
trait PrintingMode
class Object
trait Matchable
class Any
Self type
object threadMode extends PrintingMode

Adds thread name. Strings are printed as: <thread>: <string>.

Adds thread name. Strings are printed as: <thread>: <string>.

Attributes

Source
PrintingMode.scala
Supertypes
trait PrintingMode
class Object
trait Matchable
class Any
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
trait PrintingMode
class Object
trait Matchable
class Any
Self type
object threadTimeMode extends PrintingMode

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
trait PrintingMode
class Object
trait Matchable
class Any
Self type
object timeDemoMode extends PrintingMode

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
trait PrintingMode
class Object
trait Matchable
class Any
Self type
object timeMode extends PrintingMode

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
trait PrintingMode
class Object
trait Matchable
class Any
Self type
timeMode.type

Value members

Concrete methods

inline def dot[A, M <: PrintingMode](any: A, theDot: Char)(using mode: M): A

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
def info(newlines: Int): Unit

Prints basic runtime info.

Prints basic runtime info.

Attributes

Throws
IllegalArgumentException

if newLines is negative.

Source
info.scala
def plural[A](x: A, singularForm: String, pluralForm: String)(using evidence$1: Numeric[A]): String

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
def plural[A](x: A, str: String)(using evidence$1: Numeric[A]): String

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
def printf(format: String, args: Any*)(using mode: PrintingMode): Unit

Formatted printing with a format.

Formatted printing with a format.

Attributes

See also
Since

1.0

Source
printing.scala
def println(arg: Any)(using mode: PrintingMode): Unit

Formatted printing with a newline.

Formatted printing with a newline.

Attributes

See also
Since

1.0

Source
printing.scala
def printout[A](includeErr: Boolean, includeSystem: Boolean, charset: Charset)(code: => A): String

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
def printout[A](code: => A): String

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
def star[A](any: A)(using mode: PrintingMode): A

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
def timeString(seconds: Double, unitsCount: Int): String

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 or 1 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.

Standard printing. Equivalent to Predef.printf/println.

Attributes

Source
PrintingMode.scala

Adds thread name. Strings are printed as: <thread>: <string>.

Adds thread name. Strings are printed as: <thread>: <string>.

Attributes

Source
PrintingMode.scala

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

extension (str: String)

String with all CRLF replaces with LF.

String with all CRLF replaces with LF.

Attributes

Since

1.0

Source
stringExtensions.scala
def pad(minLen: Int, padding: Char): String

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
def short: String

Truncates a string to 32 characters.

Truncates a string to 32 characters.

Attributes

Since

1.0

Source
stringExtensions.scala
def short(maxLen: Int): String

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