To remove the period character from a string in C#, you can use the Replace()
method of the string
class. Here's an example:
main.cs100 chars5 lines
This will replace all occurrences of the period character (.
) with an empty string (""
), effectively removing them from the original string. The output will be:
main.cs12 chars2 lines
Note that Replace()
method returns a new string with the replaced characters, as strings are immutable in C#.
gistlibby LogSnag