How do I replace values within a string ?
The string will look like this:
gabriel = 1.73,derp = 1.80,
Take into account that this structure is: nome = altura, nome = altura,
.
In case, I want to replace the height of gabriel by 1.75, but I do not know how to tinker with patterns in c ++.
I would like to search for something like 'gabriel = (% d +)' and replace with 'gabriel = 1.75'.
Name size can be larger or smaller.
Height can have more numbers and other values.
On Lua it would look like this:
local str = "gabriel = 1.73, derp = 1.80,"
local size = string.match(str, 'gabriel = (.-),')
print(str)
str = string.gsub(str, 'gabriel = '..size..',', 'gabriel = 1.75,')
print(str)