Package mgui.util

Class StringFunctions

java.lang.Object
mgui.util.StringFunctions

public class StringFunctions
extends java.lang.Object
  • Constructor Summary

    Constructors
    Constructor Description
    StringFunctions()  
  • Method Summary

    Modifier and Type Method Description
    static int countOccurrences​(java.lang.String s, java.lang.String occ)
    Counts the number of times occ occurs in s.
    static boolean isInteger​(java.lang.String s)
    Determines whether s can be converted to an integer
    static boolean isNumeric​(java.lang.String s)
    Determines whether s can be converted to a number
    static java.lang.String replaceAll​(java.lang.String string, java.lang.String find, java.lang.String replace)
    Replaces all occurrences of find in string and replaces them with replace, without using regex.
    static java.lang.String resizeString​(java.lang.String string, int length)
    Resizes string to length length, by truncating or padding with spaces.
    static java.lang.String resizeString​(java.lang.String string, int length, char pad)
    Resizes string to length length, by truncating or padding.
    static java.lang.String trim​(java.lang.String s)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StringFunctions

      public StringFunctions()
  • Method Details

    • trim

      public static java.lang.String trim​(java.lang.String s)
    • countOccurrences

      public static int countOccurrences​(java.lang.String s, java.lang.String occ)
      Counts the number of times occ occurs in s.
      Parameters:
      s -
      occ -
      Returns:
    • resizeString

      public static java.lang.String resizeString​(java.lang.String string, int length)
      Resizes string to length length, by truncating or padding with spaces.
      Parameters:
      string -
      length -
      Returns:
    • resizeString

      public static java.lang.String resizeString​(java.lang.String string, int length, char pad)
      Resizes string to length length, by truncating or padding.
      Parameters:
      string -
      length -
      pad -
      Returns:
    • replaceAll

      public static java.lang.String replaceAll​(java.lang.String string, java.lang.String find, java.lang.String replace)
      Replaces all occurrences of find in string and replaces them with replace, without using regex.
      Parameters:
      string -
      find -
      replace -
      Returns:
    • isNumeric

      public static boolean isNumeric​(java.lang.String s)
      Determines whether s can be converted to a number
      Parameters:
      s -
      Returns:
    • isInteger

      public static boolean isInteger​(java.lang.String s)
      Determines whether s can be converted to an integer
      Parameters:
      s -
      Returns: