How to remove the £ sign from a string


#1

I currently have a string for a total price e.g. “£1,100”. How can I remove the £ sign from this string?

I have done some googling, and I would need to use the String.TrimStart method to remove an array characters, which leads to my second question, how do I set the default value for an array of characters? Would you know the syntax?

Thank you!


#2
  1. “£1,100”.Replace(“£”, “”)
  2. “£1,100”.TrimStart("£"c)
    […]
    many other variants

#3

Very nice! Thank you!
For your second method, what does the c mean? Does it declare “£” as a character?


#4

yes, it basically tells the compiler to treat the string as char


#5

Thank you!