private long sanitizeInput(String s) throws NumberFormatException {
				// Trim the string and return 0 if it's empty. This could be a partial input.
				s = (s == null ? "" : s.trim());
				if (s.isEmpty()) {
					return 0;
				}

				// Chop off the optional sign character of the string, we'll add it back later
				long sign = 1;
				if (s.startsWith("-")) {
					sign = -1;
					s = s.substring(1);
				}
				else if (s.startsWith("+")) {
					s = s.substring(1);
				}

				// Chop off the optional hex prefix...we'll decide to do hex later
				boolean hexPrefix = s.startsWith("0x") || s.startsWith("0X");
				if (hexPrefix) {
					s = s.substring(2);
				}

				// Since we might have chopped off prefixes, check again and return 0 if it's empty.
				// This could be a partial input.
				if (s.isEmpty()) {
					return 0;
				}

				return sign *
					(hexPrefix ? NumericUtilities.parseHexLong(s) : NumericUtilities.parseLong(s));
			}
Similar to {@link NumericUtilities#parseLong(String)}, but we return 0 if the string
is null, empty, or looks like a partially entered value (such as "-", "0x", etc)

@param s the string to parse
@return the parsed {@code long} value, or 0 if the string is null, empty, or looks
  like a partially entered value (such as "-", "0x", etc)
@throws NumberFormatException if the string does not represent a valid {@code long} 
  value
Ghidra/Framework/Docking/src/main/java/docking/widgets/textfield/GValidatedTextField.java