Units.from_string


Description:

[ CCode ( cname = "clutter_units_from_string" ) ]
public Units.from_string (string str)

Parses a value and updates units with it

A Units expressed in string should match:

	units: wsp* unit-value wsp* unit-name? wsp*
unit-value: number
unit-name: 'px' | 'pt' | 'mm' | 'em' | 'cm'
number: digit+
| digit* sep digit+
sep: '.' | ','
digit: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
wsp: (#0x20 | #0x9 | #0xA | #0xB | #0xC | #0xD)+

For instance, these are valid strings:

	10 px
5.1 em
24 pt
12.6 mm
.3 cm

While these are not:

	42 cats
omg!1!ponies

If no unit is specified, pixels are assumed.

Parameters:

str

the string to convert

units

a Units

Returns:

true if the string was successfully parsed, and false otherwise




2022 vala-language.org