Skip to content

Instantly share code, notes, and snippets.

@ImkeF
Last active November 19, 2019 16:47
Show Gist options
  • Save ImkeF/32145e48bdbae18d3889e19d667b92a0 to your computer and use it in GitHub Desktop.
Save ImkeF/32145e48bdbae18d3889e19d667b92a0 to your computer and use it in GitHub Desktop.
let func =
(String as text, optional Delimiter as text) as text =>
let
delimiter = if Delimiter = null then " " else Delimiter,
TextToList = List.Buffer(Text.Split(String, delimiter)),
FilterList = List.Select(TextToList, each _ <> ""),
Result = Text.Combine(FilterList, delimiter)
in
Result
, documentation = [
Documentation.Name = " Text.RemoveRepeatingCharacters
", Documentation.Description = " Removes repeating characters of the delimiter from a <code>String</code>
" , Documentation.LongDescription = " Removes repeating characters of the delimiter from a <code>String</code>. <code>Delimiter</code> is by default set to space/blank.
", Documentation.Category = " Text
", Documentation.Source = " http://wp.me/p6lgsG-M9 .
", Documentation.Author = " Imke Feldmann: www.TheBIccountant.com .
", Documentation.Examples = {[Description = " Removes repeating characters of the delimiter from a string: https://wp.me/p6lgsG-M9 .
" , Code = " RemoveRepeatingCharacters(""Imke Feldmann"")
", Result = " ""Imke Feldmann""
"]}]
in
Value.ReplaceType(func, Value.ReplaceMetadata(Value.Type(func), documentation))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment