Class StringManipulationService

java.lang.Object
com.iu.javadatastructureslab.services.StringManipulationService

public class StringManipulationService extends Object
Utility service showcasing Java string manipulation techniques.
  • Constructor Details

    • StringManipulationService

      public StringManipulationService()
  • Method Details

    • buildReservationMessage

      public String buildReservationMessage(String name, String date, String time, int tableNumber)
      Builds a reservation confirmation message from raw input values.
      Parameters:
      name - customer name
      date - reservation date
      time - reservation time
      tableNumber - table number
      Returns:
      formatted confirmation message
    • buildReservationMessage

      public String buildReservationMessage(Booking booking)
      Builds a reservation confirmation message from a booking object.
      Parameters:
      booking - booking details
      Returns:
      formatted confirmation message
    • formatCustomerName

      public String formatCustomerName(String name)
      Formats a customer name to title case.
      Parameters:
      name - raw name input
      Returns:
      formatted name
    • sanitizeInput

      public String sanitizeInput(String input)
      Strips unwanted characters from input values.
      Parameters:
      input - raw input
      Returns:
      sanitized input
    • normalizeWhitespace

      public String normalizeWhitespace(String input)
      Normalizes repeated whitespace to single spaces.
      Parameters:
      input - raw input
      Returns:
      normalized string
    • formatTableNumber

      public String formatTableNumber(int tableNumber)
      Formats a table number for display.
      Parameters:
      tableNumber - table number
      Returns:
      formatted table label
    • formatDate

      public String formatDate(String date)
      Formats the date string for display.
      Parameters:
      date - raw date input
      Returns:
      formatted date
    • formatTime

      public String formatTime(String time)
      Formats the time string into HH:mm format when possible.
      Parameters:
      time - raw time input
      Returns:
      formatted time
    • applyTemplate

      public String applyTemplate(String name, String tableNumber, String date, String time)
      Applies the message template with placeholders.
      Parameters:
      name - formatted customer name
      tableNumber - formatted table label
      date - formatted date
      time - formatted time
      Returns:
      populated message
    • reverseString

      public String reverseString(String input)
      Reverses the provided string.
      Parameters:
      input - input text
      Returns:
      reversed string
    • toUpperCase

      public String toUpperCase(String input)
      Uppercases the input string.
      Parameters:
      input - input text
      Returns:
      uppercased string
    • toLowerCase

      public String toLowerCase(String input)
      Lowercases the input string.
      Parameters:
      input - input text
      Returns:
      lowercased string
    • capitalizeFirstLetter

      public String capitalizeFirstLetter(String input)
      Capitalizes the first letter of the provided string.
      Parameters:
      input - input text
      Returns:
      string with a capitalized first letter
    • getUsedMethods

      public List<String> getUsedMethods()
      Returns the list of string methods highlighted in the demo.
      Returns:
      list of method names