* Returns UUID representation of the given string * @param {string} str The textual representation of the UUID * @returns {!UUID} The corresponding UUID value
(str)
| 103 | * @returns {!UUID} The corresponding UUID value |
| 104 | */ |
| 105 | static fromString (str) { |
| 106 | if (str.length === 0) { |
| 107 | throw new Error('Empty string!') |
| 108 | } |
| 109 | let result = new UUID() |
| 110 | str = str.replace(/[{}-]/g, '') |
| 111 | for (let i = 0; i < str.length; i++) { |
| 112 | result.data[i] = parseInt(str.substr(i * 2, 2), 16) |
| 113 | } |
| 114 | return result |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Generate nil UUID0 (all bits set to zero) |
no outgoing calls