### Function

# FwupdPlugin version_ensure_semver

since: 1.8.2

#### Declaration [src]

    gchar*
    fu_version_ensure_semver (
      const gchar* version,
      FwupdVersionFormat fmt
    )

#### Description [src]

Builds a semver from the possibly crazy version number. Depending on the `semver` value the string will be split and a string in the correct format will be returned.

Available since: 1.8.2

#### Parameters

`version`

  Type: `const gchar*`

  A version number, e.g. `V1.2.3`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`fmt`

  Type: `FwupdVersionFormat`

  A version format, e.g. `FWUPD_VERSION_FORMAT_TRIPLET`.

#### Return value

Type: `gchar*`

A version number, e.g. `1.2.3`, or `NULL` if the version was not valid.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.