kamagra how much to take

Stupid SharePoint Delimiters

I don’t like SharePoint delimiters. They make me all sorts of mad. You really get into them when working with custom field types such as multi selection bound fields. They parse out as “;#”. While that is all good for storage in SharePoint, sometimes programming against the field to pool values becomes a pain in the ass when writing WebParts or working on an arbitrary business application.

I needed a quick method to basically split on these this morning, so I threw this clunker together, which works fine. All it does is take the string parameter being passed in and use IndexOf against “;#” in order to return the first instance of the delimiter to get a starting point for the stripping. Once you have a the indexable numeric available to loop against, you can make two new strings that do the remove and replace functions, and then do all the returning.

  1. public static string[] RemoveAndReplaceFieldValue(string strFieldValue)
  2. {
  3. if (strFieldValue == null)
  4. throw new ArgumentNullException("strFieldValue");
  5.  
  6. int l_intIndex = strFieldValue.IndexOf(";#");
  7.  
  8. if (l_intIndex > -1)
  9. {
  10. string l_strRemove = strFieldValue.Remove(0, l_intIndex + 2);
  11. string l_strReplace = strFieldValue.Replace(";#" + l_strRemove, "");
  12. if (l_strRemove != null && l_strReplace != null)
  13. {
  14. return new string[] {l_strRemove, l_strReplace};
  15. }
  16. }
  17.  
  18. return new string[] { strFieldValue };
  19. }

Probably not ideal, however it sure is functional.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>