There are many situations:
encrypting and decrypting text,
file format conversion,
text formatters, and others.
Many Java String
methods such as
trim()
create a new string based on an old string.
In physics, a transducer is a device that converts one form of energy to another. For example, a photocell is a transducer because it converts light energy into electrical energy. The transducers in this chapter convert one type of string into another type of string.
A finite-state transducer (FST) is an automaton where the state transitions are labeled with:
- The symbols that cause the state transition. (This is just like an automaton.)
- An action to perform as the transition is made.
A FST has both an input string and an output string. The actions that are performed during a state transition create the output string.
A series of actions that a program performs could be considered an "output string". For example, the program that controls your microwave oven is almost certainly a finite-state transducer. Its input string is the sequence of actions you perform on its controls. Its output string is a series of signals that control the various oven components.
What does the toUpperCase()
method
of the Java String class do?