html - CsQuery - Unwrap element with whitespace character between -
i'm trying unwrap string in csquery. functionality works, want add whitespace char between each tag.
dim fragment = csquery.cq.create(<div>some text</div><div>more text</div>) dim unwraptags = new list(of string) {"div"}  each s in unwraptags     fragment(s).contents.unwrap() 'here want add whitespace between every tag next ' should outprint "some text more text ", not "some textmore text" return fragment.render(csquery.outputformatters.htmlencodingminimum) what best way achieve effect?
i figured out! iterate through elements , add whitespace before unwrap.
public function sanitizestring()     each s in unwraptags         fragment.each(addressof addwhitespace)         fragment(s).contents.unwrap()     next end function  private shared sub addwhitespace(obj idomobject)     obj.innertext &= " " end sub 
Comments
Post a Comment