Most efficient way to store a list of data as a string?

Okay, I need 1 string that will save a player’s stats, and it has to be a string. I can’t use UserPrefs either. My game needs to store the 2 weapons a player has (primary and secondary; there are pistols, sub-machine, lmg, assault, shotguns, and melee weapons), the number of grenades (0-8), number of barriers they can place (0-2), if they have equipment (claymores, etc), cash, and their current level in the game.

I guess it necessarily doesn’t have to be a string, but it has to go into a text document in 1 line (word wrap obviously doesn’t matter). This is what I’ve got so far, with decimals separating each and every item:

1a.1b.0.0.0.2.1.0.22000.18

This player has the first pistol (primary; hence why there’s an ‘a’), the fisrt sub-machine gun, 2 grenades, 1 barricade, 22,000 cash, and rank 18. I can easily just split this data and all, but do you guys know any other possible way to store this? I’m not looking to save room, because that’s not a problem.

I just want to know if you guys out there know any fancy way to ‘encode it’ and then ‘decode it’ to make it smaller (again, doesn’t really matter, but also security). Thanks

As you’ve also tagged the question with hashtable I’m guessing you’re just looking for a way to store the data and retrieve it without it necessarily being legible by humans (safer choice if you want less chance of it being tampered with).

Mike Geig did a session on Persistent Data using Binary Formatters.