The string with the %x symbols in it are parsed to find each symbol. The letter is then looked at to figure out what field is supposed to go there. Then the string is changed by removing the %x and whatever field is requested replaces it.
Usually the data comes out of variables and/or structures the program has already read or generated.
There is no function to do this if that's what you're looking for. The function is written by the programmers developing the system.