Reputation: 35
I learned that using $"" and {} allows me to handle strings more freely. And I wanted to use them in the inspector but if I type $"Hi" in the inspector it just recognizes the $ and " as normal characters.
Upvotes: 0
Views: 1350
Reputation: 36
The work around that I came up with is to:
myString.Replace("{myNumber}", $"{myNumber}")
;private string Parse(string myString, int myNumber)
OR if you want to make a reusable method you can add parameters with a default argument e.g.
private string Parse(string myString, int myNumber = 0, string name = null)
;Upvotes: 2
Reputation: 758
of course it does. $"" and {} you are talking about are c# code syntax. The inspector is a GUI, it doesn't consider your input as such, it doesn't interpret it, it considers it to be plain text.
So the short answer to your actual question "how can i?" is "you can not"... it's not meant for that.
Why don't you elaborate what you're trying to achive as suggested by CodingYoshi, so that maybe we can help you achive your end-goal without using string interpolation in the inspector
Upvotes: 3