What function is used in the editor inspector to change variable names to readable labels?

I’m trying to make an in-app inspector (for the user) for the project I’m working on. I’m using reflection to iterate over properties of different objects, and creating controls in a side panel.

Right now, for each control I make I’m just putting labels with the text set to the name of the variable associated with that control. However, I know in Unity’s inspector, the variable names get turned into nicer strings (ex. a script variable called “myScriptVariable” will have the label “My Script Variable” in the Unity inspector.)

I just wanted to know if there’s any way I can get access to whatever method does that and use it myself. Not a big deal if not, I can just write one myself, but I’m guessing there might be some edge cases I’m not thinking of. Plus it would be nice to be consistent.

Thanks.

The method exists but it is in the editor-only side of Unity: Unity - Scripting API: ObjectNames.NicifyVariableName