removeHyphens static method

String? removeHyphens(
  1. String? uuid
)

Removes hyphens from a UUID string to create the compact format.

Converts a standard UUID (36 chars) to compact format (32 chars): 123e4567-e89b-12d3-a456-426614174000123e4567e89b12d3a456426614174000

Returns:

  • The UUID without hyphens
  • null if input is null or empty

Example:

UuidUtils.removeHyphens('123e4567-e89b-12d3-a456-426614174000');
// Returns '123e4567e89b12d3a456426614174000'

Implementation

static String? removeHyphens(String? uuid) {
  if (uuid == null || uuid.isEmpty) {
    return null;
  }

  return uuid.replaceAll('-', '');
}