I am creating a custom server control with a property that accepts a String as input. What is the correct way to handle whitespace/tabs & newlines? For example,
<prefix:MyControl runat="server"
    Property="This is a long text string which is manually
              wrapped in the VS text editor on multiple
              lines."
>
</prefix:MyControl>
开发者_如何学PythonThis returns something similar to
"This is a long text string which is manually\r\n wrapped in the VS text editor on multiple\r\n lines."
Is there a special attribute I can apply to the propery to help with this? I have checked Metadata Attributes for Custom Server Controls Or do I need to manually strip the linebreaks and extra spacing?
Discovered a Regular Expression solution which finds multiple whitespace characters preceded by a line break and replaces matches with a single space.
private string property;
[Bindable(true)]
public string Property {
    get { return property; }
    set {
        property = Regex.Replace(value, @"(\n|\r|\r\n)\s+", " ");
    }
}
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论