2
How do I replace values within a string?
To string will be something like:
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 Openel by 1.75, but I don’t know how to deal with Patterns in c++.
I would like to search for something like 'Gabriel = (%d+)' and replace with 'Gabriel = 1.75'.
Name size may be larger or smaller.
Height can have more numbers and other values.
On Lua it would be 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)
Behold functioning on the ideone.
The value may be different from 1.73, so I want to know how to use Patterns (I think that’s it), in c++.
– Gabriel Sales
So put on Lua a code that does what you want, what you put on it doesn’t do.
– Maniero
Okay, now you’re right.
– Gabriel Sales