Package ghidra.util

Class StringFormat

java.lang.Object
ghidra.util.StringFormat

public class StringFormat extends Object
Class with static methods formatting values in hex.
  • Method Details

    • hexByteString

      public static String hexByteString(byte b)
      Gets a hexadecimal representation of a byte value.
      Parameters:
      b - the byte value
      Returns:
      the byte as a hexadecimal string.
    • hexWordString

      public static String hexWordString(short s)
      Gets a hexadecimal representation of a short value.
      Parameters:
      s - the short value
      Returns:
      the short as a hexadecimal string.
    • padIt

      public static String padIt(String str, int padlen, char endchar, boolean padded)
      Creates a string prepended with zeros, if padding is indicated, and adds the indicated endchar as the suffix.
      Parameters:
      str - the original string
      padlen - length of the padded string without the suffix character.
      endchar - the suffix character
      padded - if true then prepend with zeros
      Returns:
      return the possibly padded string containing the suffix.